From owner-freebsd-bugs Sun Feb 23 3:58:30 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 563E237B401; Sun, 23 Feb 2003 03:58:29 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF1BE43FBD; Sun, 23 Feb 2003 03:58:28 -0800 (PST) (envelope-from johan@FreeBSD.org) Received: from freefall.freebsd.org (johan@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NBwSNS065357; Sun, 23 Feb 2003 03:58:28 -0800 (PST) (envelope-from johan@freefall.freebsd.org) Received: (from johan@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NBwS7Q065353; Sun, 23 Feb 2003 03:58:28 -0800 (PST) Date: Sun, 23 Feb 2003 03:58:28 -0800 (PST) From: Johan Karlsson Message-Id: <200302231158.h1NBwS7Q065353@freefall.freebsd.org> To: johan@FreeBSD.org, freebsd-bugs@FreeBSD.org, tjr@FreeBSD.org Subject: Re: kern/8376: CLOCK_VIRTUAL not implemented Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: CLOCK_VIRTUAL not implemented Responsible-Changed-From-To: freebsd-bugs->tjr Responsible-Changed-By: johan Responsible-Changed-When: Sun Feb 23 03:57:29 PST 2003 Responsible-Changed-Why: Tim said he will add CLOCK_VIRTUAL. http://www.freebsd.org/cgi/query-pr.cgi?pr=8376 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 11: 0:14 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7498B37B405 for ; Sun, 23 Feb 2003 11:00:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C585743FBF for ; Sun, 23 Feb 2003 11:00:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NJ09NS065886 for ; Sun, 23 Feb 2003 11:00:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NJ09gW065885; Sun, 23 Feb 2003 11:00:09 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08C9C37B405 for ; Sun, 23 Feb 2003 10:50:50 -0800 (PST) Received: from grosbein.pp.ru (www2.svzserv.kemerovo.su [213.184.65.86]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8368D43FA3 for ; Sun, 23 Feb 2003 10:50:43 -0800 (PST) (envelope-from eugen@grosbein.pp.ru) Received: from grosbein.pp.ru (smmsp@localhost [127.0.0.1]) by grosbein.pp.ru (8.12.7/8.12.7) with ESMTP id h1NIoX99001181 for ; Mon, 24 Feb 2003 01:50:33 +0700 (KRAT) (envelope-from eugen@grosbein.pp.ru) Received: (from eugen@localhost) by grosbein.pp.ru (8.12.7/8.12.7/Submit) id h1NIZCSi000423; Mon, 24 Feb 2003 01:35:12 +0700 (KRAT) Message-Id: <200302231835.h1NIZCSi000423@grosbein.pp.ru> Date: Mon, 24 Feb 2003 01:35:12 +0700 (KRAT) From: Eugene Grosbein Reply-To: Eugene Grosbein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48599: [PATCH] syscons cut-n-paste logic is broken Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48599 >Category: kern >Synopsis: [PATCH] syscons cut-n-paste logic is broken >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Feb 23 11:00:09 PST 2003 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: Svyaz Service JSC >Environment: System: FreeBSD grosbein.pp.ru 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #13: Mon Feb 24 00:54:18 KRAT 2003 eu@grosbein.pp.ru:/usr/local/obj/usr/local/src/sys/DADV i386 >Description: Today I tried to mark and paste into a letter one message written to a console by the kernel: /kernel: linux: 'ioctl' fd=25, cmd=0x60b ('?',11) not implemented There was a symbol with code 0x06 in place of ? actually. And syscons failed to paste complete line. The last symbol pasted was "'" that stands just before 0x06. >How-To-Repeat: A simple demonstration provided by the next line: for i in `jot 7 1; do printf "$i\\$i.$i\n"; done Try to mark one of the lines (four symbols) and paste the selection - syscons will paste only first symbol. >Fix: Printed symbols 0x01, 0x02, 0x03 appear as 0x00 for mouse_cut(). I do not know if it is intended behavour. If so, it breaks cut-n-paste and that should be fixed, see patch below. Additional review of possibly unsafe sc_vtb_getc() usage may be needed. The patch is for src/sys/dev/syscons/scmouse.c, it replaces 0x00 with space (0x20) when pasting. --- scmouse.c.orig Sun Feb 23 23:29:38 2003 +++ scmouse.c Mon Feb 24 01:24:31 2003 @@ -336,7 +336,8 @@ to = start - 1; } for (p = from, i = blank = 0; p <= to; ++p) { - cut_buffer[i] = sc_vtb_getc(&scp->vtb, p); + if ((cut_buffer[i] = sc_vtb_getc(&scp->vtb, p)) == '\0') + cut_buffer[i]=' '; /* remember the position of the last non-space char */ if (!IS_SPACE_CHAR(cut_buffer[i++])) blank = i; /* the first space after the last non-space */ @@ -416,6 +417,8 @@ scp->mouse_cut_end = scp->mouse_cut_start; splx(s); cut_buffer[0] = sc_vtb_getc(&scp->vtb, scp->mouse_cut_start); + if (cut_buffer[0] == '\0') + cut_buffer[0]=' '; cut_buffer[1] = '\0'; scp->status |= MOUSE_CUTTING; } @@ -497,8 +500,9 @@ } /* copy the found word */ - for (i = 0, j = start; j <= end; ++j) - cut_buffer[i++] = sc_vtb_getc(&scp->vtb, j); + for (i = 0, j = start; j <= end; ++i, ++j) + if ((cut_buffer[i] = sc_vtb_getc(&scp->vtb, j)) == '\0') + cut_buffer[i] = ' '; cut_buffer[i] = '\0'; scp->status |= MOUSE_CUTTING; @@ -540,8 +544,9 @@ splx(s); /* copy the line into the cut buffer */ - for (i = 0, j = scp->mouse_cut_start; j <= scp->mouse_cut_end; ++j) - cut_buffer[i++] = sc_vtb_getc(&scp->vtb, j); + for (i = 0, j = scp->mouse_cut_start; j <= scp->mouse_cut_end; ++i, ++j) + if ((cut_buffer[i] = sc_vtb_getc(&scp->vtb, j)) == '\0') + cut_buffer[i] = ' '; cut_buffer[i++] = '\r'; cut_buffer[i] = '\0'; scp->status |= MOUSE_CUTTING; Eugene Grosbein >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 13: 0:27 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7778C37B401 for ; Sun, 23 Feb 2003 13:00:22 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BA2F43F93 for ; Sun, 23 Feb 2003 13:00:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NL0KNS098877 for ; Sun, 23 Feb 2003 13:00:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NL0K5w098876; Sun, 23 Feb 2003 13:00:20 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5430537B405 for ; Sun, 23 Feb 2003 12:52:21 -0800 (PST) Received: from Mail.Math.Princeton.EDU (mail.math.Princeton.EDU [128.112.18.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id A80EE43FE0 for ; Sun, 23 Feb 2003 12:52:19 -0800 (PST) (envelope-from stalker@Math.Princeton.EDU) Received: from math.Princeton.EDU (IDENT:B/s5t5lFRCdod1N1IbJfAgLA2/cpxRdl@math.Princeton.EDU [128.112.18.16]) by Mail.Math.Princeton.EDU (8.11.6/8.11.6) with ESMTP id h1NKqI107343 for ; Sun, 23 Feb 2003 15:52:18 -0500 Received: from math.Princeton.EDU (IDENT:U36bl+bL7eypouQB3wzbkMaH1sgaSBFe@localhost.localdomain [127.0.0.1]) by math.Princeton.EDU (8.11.6/8.11.6) with ESMTP id h1NKqIG09316 for ; Sun, 23 Feb 2003 15:52:18 -0500 Message-Id: <200302232052.h1NKqIG09316@math.Princeton.EDU> Date: Sun, 23 Feb 2003 15:52:18 -0500 From: John Stalker To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48603: Getopt(1) is broken. Patch included. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48603 >Category: bin >Synopsis: Getopt is broken. Patch included. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 23 13:00:20 PST 2003 >Closed-Date: >Last-Modified: >Originator: John Stalker >Release: FreeBSD 4.7-STABLE i386 >Organization: Princeton University >Environment: System: FreeBSD bilbo.dev.null 4.7-STABLE FreeBSD 4.7-STABLE #1: Fri Dec 27 23:0 0:21 EST 2002 root@rockhopper.dev.null:/usr/obj/usr/src/sys/BILBO i386 >Description: Getopt(1) does not handle arguments with spaces or shell wildcards intelligently, as its manpage admits. The main problem is that the manpage says to pass it arguments as $* rather than as "$@". This needs to be corrected, but that requires two other changes. getopt has to be changed so that its output is ready for reinterpretation by the shell and the set command needs to by preceded by an eval so that this interpretation is done correctly. >How-To-Repeat: Use the getopt(1) example, which has arguments "abo:", with arguments -ab -o "this option argument has spaces in it" or with -ab -o '/*'. >Fix: There are two possible fixes. The simpler of the two is given as a patch below. This patches both getopt and its manpage. It simply modifies getopt to single-quote option arguments--handling embedded single quotes correctly--and modifies the manpage accordingly. One can also modify getopt to escape anything which could confuse the shell rather than quoting. This is more complicated, but it might be helpful for shell scripts written according to the onld manpage. They can never be fixed properly, but they would cope better with escape sequences than single quotes. Let me know if you would like a patch for that as well. diff -Naur getopt.orig/getopt.1 getopt.fix1/getopt.1 --- getopt.orig/getopt.1 Sun Feb 23 10:47:37 2003 +++ getopt.fix1/getopt.1 Sun Feb 23 11:01:46 2003 @@ -7,7 +7,7 @@ .Nm getopt .Nd parse command options .Sh SYNOPSIS -.Nm args=\`getopt Ar optstring $*\` +.Nm args=\`getopt Ar optstring "$@"\` ; errcode=$?; set \-\- $args .Sh DESCRIPTION The @@ -46,18 +46,18 @@ which requires an argument. .Pp .Bd -literal -offset indent -args=\`getopt abo: $*\` -# you should not use \`getopt abo: "$@"\` since that would parse -# the arguments differently from what the set command below does. +args=\`getopt abo: "$@"\` if [ $? != 0 ] then echo 'Usage: ...' exit 2 fi -set \-\- $args +eval set \-\- $args # You cannot use the set command with a backquoted getopt directly, # since the exit code from getopt would be shadowed by those of set, # which is zero by definition. +# Eval is needed because set will otherwise break arguments at $IFS +# even when they are single-quoted. for i do case "$i" @@ -66,8 +66,7 @@ echo flag $i set; sflags="${i#-}$sflags"; shift;; \-o) - echo oarg is "'"$2"'"; oarg="$2"; shift; - shift;; + echo oarg is "'"$2"'"; oarg="$2"; shift 2;; \-\-) shift; break;; esac @@ -102,18 +101,13 @@ Example changed in .Fx version 3.2 and 4.0. +Modified by +.An John Stalker. .Sh BUGS Whatever .Xr getopt 3 has. .Pp -Arguments containing white space or embedded shell metacharacters -generally will not survive intact; this looks easy to fix but -isn't. People trying to fix -.Nm -or the example in this manpage should check the history of this file -in -.Fx . .Pp The error message for an invalid option is identified as coming from @@ -121,7 +115,7 @@ rather than from the shell procedure containing the invocation of .Nm ; -this again is hard to fix. +this is hard to fix. .Pp The precise best way to use the .Nm set diff -Naur getopt.orig/getopt.c getopt.fix1/getopt.c --- getopt.orig/getopt.c Sun Feb 23 10:47:37 2003 +++ getopt.fix1/getopt.c Sun Feb 23 09:56:22 2003 @@ -18,10 +18,18 @@ status = 1; /* getopt routine gave message */ break; default: - if (optarg != NULL) - printf(" -%c %s", c, optarg); - else - printf(" -%c", c); + printf(" -%c", c); + if (optarg != NULL) { /* quote argument for shell */ + printf(" '"); + while (*optarg != '\0') { + if (optarg[0] == '\'') + printf("'\''"); + else + printf("%c", optarg[0]); + optarg++; + } + printf("'"); + } break; } printf(" --"); -- John Stalker Department of Mathematics Princeton University (609)258-6469 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 13:24:49 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8410637B401 for ; Sun, 23 Feb 2003 13:24:44 -0800 (PST) Received: from server.optokon.cz (server.optokon.cz [212.67.73.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A69643FB1 for ; Sun, 23 Feb 2003 13:24:43 -0800 (PST) (envelope-from ) Received: from smtp0147.mail.yahoo.com (202.174.40.71 [202.174.40.71]) by server.optokon.cz with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 16DTPDJ6; Sun, 23 Feb 2003 22:25:32 +0100 Date: Sun, 23 Feb 2003 21:22:47 GMT From: "jerah " <> X-Priority: 3 To: bugs@fnprg.com Cc: bugs@forteinc.com, bugs@france.com, bugs@franchiseamerica.com, bugs@freebsd.netcom.com, bugs@freebsd.org, bugs@freepictures.com, bugs@freewareworld.com, bugs@freeway.net Subject: HEALTH Mime-Version: 1.0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030223212443.4A69643FB1@mx1.FreeBSD.org> Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org

"It's a Silent Epidemic." -Oprah
"43% of Women are affected."
-The Journal of the American Medical Association

Do you ever feel like this?

Sex is NOT working for me  ...What can I do?

"Sex might not be everything but it registers higher (90%) on the "Importance Scale" if it's a source of frustration in your relationship. If your sex life is unfulfilled, it becomes a GIGANTIC issue. On the other hand, couples that have satisfying sex lives rate sex at only 10% on the "Importance Scale." - Dr. Phil

There are some REAL causes for sexual dissatisfaction for women.

Birth Control Pills. Antidepressants. Medications. Hormonal Imbalance. Stress. Exhaustion.
 What if we could help you?

We have a revolutionary personal lubricant and sexual enhancement cream for women. Studies prove that it can increase female arousal, sensual excitement and sexual pleasure. 94% of women tested reported improved responsiveness! Their partners agreed. "We will never be without it again...It has truly changed our relationship...and, it has changed me. I am a nicer person to be around now that I am not so frustrated." Julie, 32 years old, CA.
It is for all women.  From those who experience dissatisfaction to those who wish to enhance their sexual experiences to even higher levels of pleasure. The women's' sexual health experts, the two Dr. Bermans say that "70% of all couples have sexual problems at some point in their relationship." This contributes to the fact that one of every three divorces is because of sexual problems. Imagine for a moment - enhancing YOUR passion, intimacy and your relationship.
By increasing female arousal and sexual pleasure, our product does for women's sexual health what that famous blue pill has done for men.
Developed and patented by a leading OB/GYN - enhancing the Quality of Your Life. It is the FIRST product of its kind and is the # 1 choice of 30 Million women in 25 countries.

Click here for details on this revolutionary product

Please Remove

To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 13:57:37 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B933E37B401; Sun, 23 Feb 2003 13:57:36 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C64E43F3F; Sun, 23 Feb 2003 13:57:36 -0800 (PST) (envelope-from johan@FreeBSD.org) Received: from freefall.freebsd.org (johan@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NLvaNS015682; Sun, 23 Feb 2003 13:57:36 -0800 (PST) (envelope-from johan@freefall.freebsd.org) Received: (from johan@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NLvaOf015678; Sun, 23 Feb 2003 13:57:36 -0800 (PST) Date: Sun, 23 Feb 2003 13:57:36 -0800 (PST) From: Johan Karlsson Message-Id: <200302232157.h1NLvaOf015678@freefall.freebsd.org> To: johan@FreeBSD.org, freebsd-bugs@FreeBSD.org, ru@FreeBSD.org Subject: Re: bin/46676: [PATCH] bsd.dep.mk restricts domain of tags commands Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: [PATCH] bsd.dep.mk restricts domain of tags commands Responsible-Changed-From-To: freebsd-bugs->ru Responsible-Changed-By: johan Responsible-Changed-When: Sun Feb 23 13:57:16 PST 2003 Responsible-Changed-Why: Over to share/mk guru. http://www.freebsd.org/cgi/query-pr.cgi?pr=46676 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 14:22:20 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AD5937B401; Sun, 23 Feb 2003 14:22:19 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EE30943FD7; Sun, 23 Feb 2003 14:22:18 -0800 (PST) (envelope-from mtm@FreeBSD.org) Received: from freefall.freebsd.org (mtm@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NMMINS025716; Sun, 23 Feb 2003 14:22:18 -0800 (PST) (envelope-from mtm@freefall.freebsd.org) Received: (from mtm@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NMMI4P025712; Sun, 23 Feb 2003 14:22:18 -0800 (PST) Date: Sun, 23 Feb 2003 14:22:18 -0800 (PST) From: Mike Makonnen Message-Id: <200302232222.h1NMMI4P025712@freefall.freebsd.org> To: huntting@glarp.com, mtm@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: misc/28188: Cron is being started to early in /etc/rc (potential security hole) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: Cron is being started to early in /etc/rc (potential security hole) State-Changed-From-To: analyzed->closed State-Changed-By: mtm State-Changed-When: Sun Feb 23 14:17:34 PST 2003 State-Changed-Why: The new rc.d system takes care of the specific complaints in the PR, namely that cron was being run before securelevel. The other issues raised as a result of this are moot now that rc.d is in the tree and the default. An admin can very easily move the setting of the securelevel earlier or later according to his/her situation. Tools not policy :-) http://www.freebsd.org/cgi/query-pr.cgi?pr=28188 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 14:47:32 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0952337B401; Sun, 23 Feb 2003 14:47:32 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E6FE43FD7; Sun, 23 Feb 2003 14:47:31 -0800 (PST) (envelope-from mtm@FreeBSD.org) Received: from freefall.freebsd.org (mtm@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NMlVNS030075; Sun, 23 Feb 2003 14:47:31 -0800 (PST) (envelope-from mtm@freefall.freebsd.org) Received: (from mtm@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NMlVU9030071; Sun, 23 Feb 2003 14:47:31 -0800 (PST) Date: Sun, 23 Feb 2003 14:47:31 -0800 (PST) From: Mike Makonnen Message-Id: <200302232247.h1NMlVU9030071@freefall.freebsd.org> To: mtm@FreeBSD.org, freebsd-bugs@FreeBSD.org, mtm@FreeBSD.org Subject: Re: conf/46103: /etc/rc.d/ipfilter; ipfilter_start() need to enable ipfilter Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: /etc/rc.d/ipfilter; ipfilter_start() need to enable ipfilter Responsible-Changed-From-To: freebsd-bugs->mtm Responsible-Changed-By: mtm Responsible-Changed-When: Sun Feb 23 14:44:58 PST 2003 Responsible-Changed-Why: It looks reasonable, but since I don't know much about ipfilter it will take me some time to test. Take this PR so I don't forget about it. http://www.freebsd.org/cgi/query-pr.cgi?pr=46103 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 14:52: 7 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B73437B406 for ; Sun, 23 Feb 2003 14:52:06 -0800 (PST) Received: from ints.mail.pike.ru (ints.mail.pike.ru [195.9.45.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95D7E43FE0 for ; Sun, 23 Feb 2003 14:52:03 -0800 (PST) (envelope-from babolo@cicuta.babolo.ru) Received: (qmail 40480 invoked from network); 23 Feb 2003 23:08:33 -0000 Received: from babolo.ru (HELO cicuta.babolo.ru) (194.58.226.160) by ints.mail.pike.ru with SMTP; 23 Feb 2003 23:08:33 -0000 Received: (nullmailer pid 4874 invoked by uid 136); Sun, 23 Feb 2003 22:54:01 -0000 Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs X-ELM-OSV: (Our standard violations) hdr-charset=KOI8-R; no-hdr-encoding=1 In-Reply-To: <200302230214.h1N2EYbf011584@freefall.freebsd.org> To: Giorgos Keramidas Date: Mon, 24 Feb 2003 01:54:01 +0300 (MSK) From: "."@babolo.ru Cc: freebsd-bugs@FreeBSD.ORG, FreeBSD-gnats-submit@FreeBSD.ORG, dillon@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <1046040841.671627.4873.nullmailer@cicuta.babolo.ru> Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > Synopsis: Cannot "rm -rf" for not-existed file on read-only nfs > > Responsible-Changed-From-To: dillon->freebsd-bugs > Responsible-Changed-By: keramida > Responsible-Changed-When: Sat Feb 22 18:14:28 PST 2003 > Responsible-Changed-Why: > Back to the free pool. Look at bin/35842 with patch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 15: 0:19 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9077D37B401 for ; Sun, 23 Feb 2003 15:00:17 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08BAE43FB1 for ; Sun, 23 Feb 2003 15:00:17 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NN0GNS032553 for ; Sun, 23 Feb 2003 15:00:16 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NN0GSZ032552; Sun, 23 Feb 2003 15:00:16 -0800 (PST) Date: Sun, 23 Feb 2003 15:00:16 -0800 (PST) Message-Id: <200302232300.h1NN0GSZ032552@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "."@babolo.ru Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs Reply-To: "."@babolo.ru Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/16815; it has been noted by GNATS. From: "."@babolo.ru To: Giorgos Keramidas Cc: freebsd-bugs@FreeBSD.ORG, FreeBSD-gnats-submit@FreeBSD.ORG, dillon@FreeBSD.ORG Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs Date: Mon, 24 Feb 2003 01:54:01 +0300 (MSK) > Synopsis: Cannot "rm -rf" for not-existed file on read-only nfs > > Responsible-Changed-From-To: dillon->freebsd-bugs > Responsible-Changed-By: keramida > Responsible-Changed-When: Sat Feb 22 18:14:28 PST 2003 > Responsible-Changed-Why: > Back to the free pool. Look at bin/35842 with patch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 15:16:10 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D751937B401; Sun, 23 Feb 2003 15:16:09 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 792CF43F85; Sun, 23 Feb 2003 15:16:09 -0800 (PST) (envelope-from mtm@FreeBSD.org) Received: from freefall.freebsd.org (mtm@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NNG9NS040897; Sun, 23 Feb 2003 15:16:09 -0800 (PST) (envelope-from mtm@freefall.freebsd.org) Received: (from mtm@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NNG9lY040893; Sun, 23 Feb 2003 15:16:09 -0800 (PST) Date: Sun, 23 Feb 2003 15:16:09 -0800 (PST) From: Mike Makonnen Message-Id: <200302232316.h1NNG9lY040893@freefall.freebsd.org> To: dirkx@covalent.net, mtm@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: misc/39353: /usr/share/examples/diskless clone root creates a superfluous /conf/etc and ignores dest dir Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: /usr/share/examples/diskless clone root creates a superfluous /conf/etc and ignores dest dir State-Changed-From-To: open->closed State-Changed-By: mtm State-Changed-When: Sun Feb 23 15:14:45 PST 2003 State-Changed-Why: Matt fixed this in his most recent diskless work. http://www.freebsd.org/cgi/query-pr.cgi?pr=39353 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 15:30: 4 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 055FB37B401 for ; Sun, 23 Feb 2003 15:30:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A22F443FBF for ; Sun, 23 Feb 2003 15:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NNU2NS043492 for ; Sun, 23 Feb 2003 15:30:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NNU2QI043491; Sun, 23 Feb 2003 15:30:02 -0800 (PST) Date: Sun, 23 Feb 2003 15:30:02 -0800 (PST) Message-Id: <200302232330.h1NNU2QI043491@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Mike Makonnen Subject: Re: conf/40548 list of /etc/defaults/make.conf undocummented variables (no fix yet) Reply-To: Mike Makonnen Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR conf/40548; it has been noted by GNATS. From: Mike Makonnen To: bug-followup@freebsd.org Cc: Subject: Re: conf/40548 list of /etc/defaults/make.conf undocummented variables (no fix yet) Date: Sun, 23 Feb 2003 18:24:05 -0500 This one's from PR conf/30400 Apologies for the cut-n-paste... Originator Glenn Johnson System: FreeBSD node7.cluster.srrc.usda.gov 4.4-RC FreeBSD 4.4-RC #4: Tue Sep 4 16:55:10 CDT 2001 root@node7.cluster.srrc.usda.gov:/usr/obj/usr/src/sys/CLUSTER-UP i386 Fix Apply the enclosed patch to src/etc/defaults/make.conf --- make.conf.orig Thu Sep 6 10:55:33 2001 +++ make.conf Thu Sep 6 11:05:56 2001 @@ -53,6 +53,12 @@ # #CXXFLAGS+= -fmemoize-lookups -fsave-memoized # +# FFLAGS controls the compiler settings used when compiling Fortran +# code. Note that the -O flag is set by default so flags should be +# added with "+=" rather than "=". +# +#FFLAGS+= -fno-globals -Wno-globals +# # BDECFLAGS are a set of gcc warning settings that Bruce Evans has suggested # for use in developing FreeBSD and testing changes. They can be used by # putting "CFLAGS+=${BDECFLAGS}" in /etc/make.conf. -Wconversion is not -- Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc mtm@identd.net | Fingerprint: D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 15:34:48 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A098E37B401; Sun, 23 Feb 2003 15:34:47 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4164143F3F; Sun, 23 Feb 2003 15:34:47 -0800 (PST) (envelope-from mtm@FreeBSD.org) Received: from freefall.freebsd.org (mtm@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NNYlNS045586; Sun, 23 Feb 2003 15:34:47 -0800 (PST) (envelope-from mtm@freefall.freebsd.org) Received: (from mtm@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NNYkjR045582; Sun, 23 Feb 2003 15:34:46 -0800 (PST) Date: Sun, 23 Feb 2003 15:34:46 -0800 (PST) From: Mike Makonnen Message-Id: <200302232334.h1NNYkjR045582@freefall.freebsd.org> To: gjohnson@srrc.ars.usda.gov, mtm@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: conf/30400: Provide a useful sample FFLAGS entry in /etc/defaults/make.conf Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: Provide a useful sample FFLAGS entry in /etc/defaults/make.conf State-Changed-From-To: open->closed State-Changed-By: mtm State-Changed-When: Sun Feb 23 15:33:40 PST 2003 State-Changed-Why: Duplicate of PR conf/40548 http://www.freebsd.org/cgi/query-pr.cgi?pr=30400 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 15:36:38 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A752237B407; Sun, 23 Feb 2003 15:36:37 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A334144015; Sun, 23 Feb 2003 15:36:20 -0800 (PST) (envelope-from dan@FreeBSD.org) Received: from freefall.freebsd.org (dan@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1NNaKNS045758; Sun, 23 Feb 2003 15:36:20 -0800 (PST) (envelope-from dan@freefall.freebsd.org) Received: (from dan@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1NNaKMK045754; Sun, 23 Feb 2003 15:36:20 -0800 (PST) Date: Sun, 23 Feb 2003 15:36:20 -0800 (PST) From: Dan Moschuk Message-Id: <200302232336.h1NNaKMK045754@freefall.freebsd.org> To: sascha@root-login.org, dan@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/48559: if_rl: Peppercon Realteak devices are not recognized Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: if_rl: Peppercon Realteak devices are not recognized State-Changed-From-To: open->closed State-Changed-By: dan State-Changed-When: Sun Feb 23 15:35:57 PST 2003 State-Changed-Why: Committed! Thanks! http://www.freebsd.org/cgi/query-pr.cgi?pr=48559 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 17:30:13 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3E49437B401 for ; Sun, 23 Feb 2003 17:30:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 65C7643F75 for ; Sun, 23 Feb 2003 17:30:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1O1UANS076787 for ; Sun, 23 Feb 2003 17:30:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1O1UA8W076786; Sun, 23 Feb 2003 17:30:10 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FA8E37B401 for ; Sun, 23 Feb 2003 17:21:58 -0800 (PST) Received: from bluewasp.waspware.com (bluewasp.waspware.com [213.88.141.120]) by mx1.FreeBSD.org (Postfix) with SMTP id 3793543F85 for ; Sun, 23 Feb 2003 17:21:56 -0800 (PST) (envelope-from dront@bluewasp.waspware.com) Received: (qmail 53183 invoked by uid 0); 24 Feb 2003 01:23:16 -0000 Message-Id: <20030224012316.53182.qmail@bluewasp.waspware.com> Date: 24 Feb 2003 01:23:16 -0000 From: sm@mitradata.com Reply-To: sm@mitradata.com To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48609: panic: ufsdirhash_lookup: bad offset in hash array Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48609 >Category: kern >Synopsis: panic: ufsdirhash_lookup: bad offset in hash array >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 23 17:30:09 PST 2003 >Closed-Date: >Last-Modified: >Originator: Supriya Mitra >Release: FreeBSD 4.6-STABLE i386 >Organization: >Environment: System: FreeBSD bluewasp.waspware.com 4.6-STABLE FreeBSD 4.6-STABLE #0: Sun Aug 4 16:22:19 CEST 2002 dront@bluewasp.waspware.com:/usr/obj/usr/src/sys/BLUEWASP i386 UFS_DIRHASH enabled in kernel. CPU: AMD Athlon(tm) XP 1600+ (1399.34-MHz 686-class CPU) real memory = 1073741824 (1048576K bytes) asr0: mem 0xda000000-0xdbffffff irq 12 at device 8.1 on pci0 asr0: major=154 asr0: ADAPTEC 2400A FW Rev. 370L, 4 channel, 256 CCBs, Protocol I2O da0: Fixed Direct Access SCSI-2 device da0: Tagged Queueing Enabled da0: 117288MB (240205824 512 byte sectors: 255H 63S/T 14952C) >Description: kernel panics since freebsd kernel 4.2, on average of every 20 days i get /kernel: panic: ffs_clusteralloc: map mismatch /kernel: panic: ufsdirhash_lookup: bad offset in hash array or /kernel: panic: ufsdirhash_lookup: bad offset in hash array /kernel: syncing disks... 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 /kernel: giving up on 1 buffers and then automatic reboot often happens during syste mload. but cannot reproduce the panic myself. >How-To-Repeat: don't know, it just happens >Fix: don't know how to fix. will try turning off UFS_DIRHASH and update kernel. (have tried updating kernel since 4.2 but doesn't work) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 19:11:35 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 17E6F37B401; Sun, 23 Feb 2003 19:11:34 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 31B3A43F93; Sun, 23 Feb 2003 19:11:32 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id OAA12593; Mon, 24 Feb 2003 14:11:19 +1100 Date: Mon, 24 Feb 2003 14:12:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "."@babolo.ru Cc: Giorgos Keramidas , , , Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs In-Reply-To: <1046040841.671627.4873.nullmailer@cicuta.babolo.ru> Message-ID: <20030224141118.U4971-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Mon, 24 Feb 2003 .@babolo.ru wrote: > > Synopsis: Cannot "rm -rf" for not-existed file on read-only nfs > > > > Responsible-Changed-From-To: dillon->freebsd-bugs > > Responsible-Changed-By: keramida > > Responsible-Changed-When: Sat Feb 22 18:14:28 PST 2003 > > Responsible-Changed-Why: > > Back to the free pool. > Look at bin/35842 with patch Yes; this seems to be simpler than I first though. rm -f works so there is no problem in the kernel. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 19:20: 7 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C17037B401 for ; Sun, 23 Feb 2003 19:20:06 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE3CE43FCB for ; Sun, 23 Feb 2003 19:20:05 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1O3K5NS008399 for ; Sun, 23 Feb 2003 19:20:05 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1O3K5KH008398; Sun, 23 Feb 2003 19:20:05 -0800 (PST) Date: Sun, 23 Feb 2003 19:20:05 -0800 (PST) Message-Id: <200302240320.h1O3K5KH008398@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/16815; it has been noted by GNATS. From: Bruce Evans To: "."@babolo.ru Cc: Giorgos Keramidas , , , Subject: Re: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs Date: Mon, 24 Feb 2003 14:12:29 +1100 (EST) On Mon, 24 Feb 2003 .@babolo.ru wrote: > > Synopsis: Cannot "rm -rf" for not-existed file on read-only nfs > > > > Responsible-Changed-From-To: dillon->freebsd-bugs > > Responsible-Changed-By: keramida > > Responsible-Changed-When: Sat Feb 22 18:14:28 PST 2003 > > Responsible-Changed-Why: > > Back to the free pool. > Look at bin/35842 with patch Yes; this seems to be simpler than I first though. rm -f works so there is no problem in the kernel. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 19:30: 6 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47CD037B401 for ; Sun, 23 Feb 2003 19:30:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90A1143FBF for ; Sun, 23 Feb 2003 19:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1O3U2NS010532 for ; Sun, 23 Feb 2003 19:30:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1O3U25v010531; Sun, 23 Feb 2003 19:30:02 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E30037B401 for ; Sun, 23 Feb 2003 19:20:43 -0800 (PST) Received: from qubix.ca (d57-117-31.home.cgocable.net [24.57.117.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C20543F93 for ; Sun, 23 Feb 2003 19:20:40 -0800 (PST) (envelope-from root@qubix.ca) Received: by qubix.ca (Postfix, from userid 0) id 960F445043; Sun, 23 Feb 2003 22:20:39 -0500 (EST) Message-Id: <20030224032039.960F445043@qubix.ca> Date: Sun, 23 Feb 2003 22:20:39 -0500 (EST) From: terminus@qubix.ca Reply-To: terminus@qubix.ca To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: i386/48612: make buildworld refuses to build on -CURRENT Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48612 >Category: i386 >Synopsis: make buildworld refuses to build on -CURRENT >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 23 19:30:00 PST 2003 >Closed-Date: >Last-Modified: >Originator: Terminus >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD qubix.ca 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sat Feb 8 16:31:13 EST 2003 root@qubix.ca:/usr/src/sys/i386/compile/QUBIX i386 Sources current as of: 23 Feb 2003 >Description: objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x2000 -f bin -b /usr/obj/usr/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.01 size=780 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=1691 text=0 data=0 bss=0 entry=0 output: fmt=bin size=1f25 text=114 data=1e11 org=0 entry=0 -293 bytes available *** Error code 1 >How-To-Repeat: cvsup sources, and make buildworld on i386. >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 20:50:16 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D20A37B401 for ; Sun, 23 Feb 2003 20:50:12 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD44643FBD for ; Sun, 23 Feb 2003 20:50:11 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1O4oBNS031895 for ; Sun, 23 Feb 2003 20:50:11 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1O4oBIO031894; Sun, 23 Feb 2003 20:50:11 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C8D1037B401 for ; Sun, 23 Feb 2003 20:49:59 -0800 (PST) Received: from shell.spyder.web.za (shell.spyder.web.za [193.201.200.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12D2943FA3 for ; Sun, 23 Feb 2003 20:49:59 -0800 (PST) (envelope-from ljb@neverborn.org) Received: from ljb by shell.spyder.web.za with local (Exim 3.36 #1) id 18nAYv-000EzT-00 for FreeBSD-gnats-submit@freebsd.org; Mon, 24 Feb 2003 04:49:57 +0000 Message-Id: Date: Mon, 24 Feb 2003 04:49:57 +0000 From: leon j breedt Reply-To: leon j breedt To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48614: VESA VGA modes for syscons lock up machine Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48614 >Category: kern >Synopsis: VESA VGA modes for syscons lock up machine >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 23 20:50:11 PST 2003 >Closed-Date: >Last-Modified: >Originator: leon j breedt >Release: FreeBSD 5.0-RELEASE i386 >Organization: >Environment: System: FreeBSD valhalla.neverborn.ORG 5.0-RELEASE FreeBSD 5.0-RELEASE #5: Fri Feb 14 12:15:04 NZDT 2003 root@shih.neverborn.ORG:/usr/src/sys/i386/compile/SHIH i386 ASUS P4PE Motherboard (BIOSrev 1002) Intel Pentium 4 2.4Ghz LeadTek Ultra 250 TD Geforce4 Ti4600 CPUTYPE=p4 in /etc/make.conf Relevant kernel compilation options: options VESA options SC_PIXEL_MODE dmesg output: VESA: v3.0, 131072k memory, flags:0x1, mode table:0xc03f2ac2 (1000022) VESA: WinFast VGA BIOS. nvidia0: mem 0xef800000-0xef87ffff,0xf0000000-0xf7ffffff,0xee000000-0xeeffffff irq 5 at device 0.0 on pci1 >Description: Using vidcontrol(1) to change the video mode to most modes past 80x50 locks up the machine solid, sometimes rebooting, sometimes locking up with a beep. No panics occur. The same hardware on Linux 2.4.20 does not exhibit this problem, and handles the extended modes without an issue. The problem is experienced with and without the NVIDIA accelerated display drivers. >How-To-Repeat: $ vidcontrol 132x50 >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sun Feb 23 22: 0:42 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E54E737B401 for ; Sun, 23 Feb 2003 22:00:33 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 102D243F75 for ; Sun, 23 Feb 2003 22:00:33 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1O60WNS051126 for ; Sun, 23 Feb 2003 22:00:32 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1O60Wo9051125; Sun, 23 Feb 2003 22:00:32 -0800 (PST) Date: Sun, 23 Feb 2003 22:00:32 -0800 (PST) Message-Id: <200302240600.h1O60Wo9051125@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Evgueni V. Gavrilov" Subject: Re: kern/42277: still climbing (6 months later) Reply-To: "Evgueni V. Gavrilov" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/42277; it has been noted by GNATS. From: "Evgueni V. Gavrilov" To: freebsd-gnats-submit@FreeBSD.org, mckusick@mckusick.com Cc: Subject: Re: kern/42277: still climbing (6 months later) Date: Mon, 24 Feb 2003 11:56:45 +0600 6 months after PR submitting the bug is still climbing... please, turn some FS-guys to look it - the only way to avoid yhe bug - to turn softupdates off. :-( I can provide crashdumps and more on that box. IdlePTD at phsyical address 0x00386000 initial pcb at physical address 0x002f0820 panicstr: softdep_lock: locking against myself panic messages: --- Fatal trap 12: page fault while in kernel mode fault virtual address = 0xffff000a fault code = supervisor read, page not present instruction pointer = 0x8:0xc022b510 stack pointer = 0x10:0xcd114d10 frame pointer = 0x10:0xcd114d10 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 5 (syncer) interrupt mask = bio trap number = 12 panic: page fault syncing disks... panic: softdep_lock: locking against myself Uptime: 19h3m41s dumping to dev #da/0x20009, offset 128 dump 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 12 9 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 --- #0 dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487 487 if (dumping++) { (kgdb) where #0 dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487 #1 0xc0188d8f in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:316 #2 0xc01891b4 in poweroff_wait (junk=0xc02add80, howto=-967414684) at /usr/src/sys/kern/kern_shutdown.c:595 #3 0xc022b242 in acquire_lock (lk=0xc02deb9c) at /usr/src/sys/ufs/ffs/ffs_softdep.c:261 #4 0xc0230940 in softdep_count_dependencies (bp=0xc6566c64, wantcount=0) at /usr/src/sys/ufs/ffs/ffs_softdep.c:4792 #5 0xc0233b84 in ffs_fsync (ap=0xcd114bb0) at /usr/src/sys/ufs/ffs/ffs_vnops.c:168 #6 0xc0232667 in ffs_sync (mp=0xc12e8600, waitfor=2, cred=0xc0a60580, p=0xc03050e0) at vnode_if.h:558 #7 0xc01b94bf in sync (p=0xc03050e0, uap=0x0) at /usr/src/sys/kern/vfs_syscalls.c:576 #8 0xc0188b2a in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:235 #9 0xc01891b4 in poweroff_wait (junk=0xc02beb8c, howto=-1070864721) at /usr/src/sys/kern/kern_shutdown.c:595 #10 0xc02769a6 in trap_fatal (frame=0xcd114cd0, eva=4294901770) at /usr/src/sys/i386/i386/trap.c:974 #11 0xc0276679 in trap_pfault (frame=0xcd114cd0, usermode=0, eva=4294901770) at /usr/src/sys/i386/i386/trap.c:867 #12 0xc0276263 in trap (frame={tf_fs = -854523888, tf_es = -1046544368, tf_ds = 16, tf_edi = 0, tf_esi = -1046538240, tf_ebp = -854504176, tf_isp = -854504196, tf_ebx = -65536, tf_edx = -1048670080, tf_ecx = -65536, tf_eax = -1048670080, tf_trapno = 12, tf_err = 0, tf_eip = -1071467248, tf_cs = 8, tf_eflags = 66071, tf_esp = -854504144, tf_ss = -1071451118}) at /usr/src/sys/i386/i386/trap.c:466 #13 0xc022b510 in worklist_remove (item=0xffff0000) at /usr/src/sys/ufs/ffs/ffs_softdep.c:467 #14 0xc022f412 in softdep_update_inodeblock (ip=0xc19f1800, bp=0xc658d5b4, waitfor=0) at /usr/src/sys/ufs/ffs/ffs_softdep.c:3847 #15 0xc022a391 in ffs_update (vp=0xcd8e1380, waitfor=0) at /usr/src/sys/ufs/ffs/ffs_inode.c:106 #16 0xc022a675 in ffs_truncate (vp=0xcd8e1380, length=0, flags=0, cred=0x0, p=0xcc008780) at /usr/src/sys/ufs/ffs/ffs_inode.c:201 #17 0xc02353fc in ufs_inactive (ap=0xcd114ed8) at /usr/src/sys/ufs/ufs/ufs_inode.c:89 #18 0xc023a825 in ufs_vnoperate (ap=0xcd114ed8) at /usr/src/sys/ufs/ufs/ufs_vnops.c:2376 #19 0xc01b7610 in vput (vp=0xcd8e1380) at vnode_if.h:815 #20 0xc022e218 in handle_workitem_remove (dirrem=0xc18b3780) at /usr/src/sys/ufs/ffs/ffs_softdep.c:2852 #21 0xc022b891 in process_worklist_item (matchmnt=0x0, flags=0) at /usr/src/sys/ufs/ffs/ffs_softdep.c:716 #22 0xc022b736 in softdep_process_worklist (matchmnt=0x0) at /usr/src/sys/ufs/ffs/ffs_softdep.c:622 #23 0xc01b6f37 in sched_sync () at /usr/src/sys/kern/vfs_subr.c:1177 (kgdb) up 4 #4 0xc0230940 in softdep_count_dependencies (bp=0xc6566c64, wantcount=0) at /usr/src/sys/ufs/ffs/ffs_softdep.c:4792 4792 ACQUIRE_LOCK(&lk); (kgdb) p lk $1 = {lkt_spl = 0, lkt_held = -1} $ uname -a FreeBSD ns2.rsb.local 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #0: Sun Feb 23 11:04:58 OMST 2003 aquatique@ns2.rsb.local:/usr/obj/usr/src/sys/NEWMONSTER i386 kernel is: machine i386 cpu I686_CPU ident NEWMONSTER maxusers 128 makeoptions DEBUG=-g options CPU_ENABLE_SSE options INET options FFS options FFS_ROOT options MFS options NFS options PROCFS options CD9660 options COMPAT_43 options UCONSOLE options USERCONFIG options VISUAL_USERCONFIG options PERFMON options SYSVSHM options SYSVMSG options SYSVSEM options SHMMAXPGS=16384 # max amount of shared memory pages (4k on i386) options SHMALL=16384 # max amount of shared memory (bytes) options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)" options MSGMNB=8192 # max # of bytes in a queue options MSGMNI=256 # number of message queue identifiers per system options MSGSEG=2048 # number of message segments per queue options MSGSSZ=64 # size of a message segment options MSGTQL=8192 # max messages in system per system options SEMMAP=512 options SEMMNI=512 options SEMMNS=1024 options SEMMNU=512 options P1003_1B options _KPOSIX_PRIORITY_SCHEDULING options _KPOSIX_VERSION=199309L options INCLUDE_CONFIG_FILE options IPFILTER options IPFILTER_LOG options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_DEFAULT_TO_ACCEPT options IPFW2 options RANDOM_IP_ID options ICMP_BANDLIM options PANIC_REBOOT_WAIT_TIME=20 options SMBFS options LIBMCHAIN options LIBICONV options NETSMB options NETSMBCRYPTO options UFS_DIRHASH options SOFTUPDATES device isa device pci device fdc0 at isa? port IO_FD1 irq 6 drq 2 device fd0 at fdc0 drive 0 device fd1 at fdc0 drive 1 device ata0 at isa? port IO_WD1 irq 14 device ata1 at isa? port IO_WD2 irq 15 device ata device atadisk device atapicd options ATA_STATIC_ID device ahc device aic0 at isa? device scbus device da device sa device cd device pass device atkbdc0 at isa? port IO_KBD device atkbd0 at atkbdc? irq 1 device vga0 at isa? device sc0 at isa? flags 0x100 options SC_HISTORY_SIZE=1024 device npx0 at nexus? port IO_NPX irq 13 device sio0 at isa? port IO_COM1 flags 0x10 irq 4 device sio1 at isa? port IO_COM2 irq 3 device sio2 at isa? disable port IO_COM3 irq 5 device sio3 at isa? disable port IO_COM4 irq 9 device puc options PUC_FASTINTR device miibus device fxp device dc pseudo-device loop pseudo-device ether pseudo-device tun 4 pseudo-device ppp 4 pseudo-device pty pseudo-device bpf 4 pseudo-device vn 2 pseudo-device gzip pseudo-device splash pseudo-device snp dmesg are: Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.8-PRERELEASE #0: Sun Feb 23 11:04:58 OMST 2003 aquatique@ns2.rsb.local:/usr/obj/usr/src/sys/NEWMONSTER Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 999724552 Hz CPU: Intel Pentium III (999.72-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x68a Stepping = 10 Features=0x387fbff real memory = 268369920 (262080K bytes) avail memory = 257544192 (251508K bytes) Preloaded elf kernel "kernel" at 0xc0367000. Preloaded elf module "accf_http.ko" at 0xc036709c. netsmb_dev: loaded Pentium Pro MTRR support enabled Using $PIR table, 268435454 entries at 0xc00fdf10 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 pci0: at 2.0 irq 11 fxp0: port 0x5880-0x58bf mem 0xfb000000-0xfb0fffff,0xfb101000-0xfb101fff irq 10 at device 3.0 on pci0 fxp0: Ethernet address 00:d0:b7:b8:ab:64 inphy0: on miibus0 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto dc0: port 0x5400-0x54ff mem 0xfb102000-0xfb1020ff irq 5 at device 7.0 on pci0 dc0: Ethernet address: 00:80:ad:08:12:2b miibus1: on dc0 ukphy0: on miibus1 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto puc0: port 0x5c00-0x5c0f,0x58c0-0x58ff,0x5800-0x587f irq 12 at device 8.0 on pci0 sio4: type 16550A sio5: type 16550A sio6: type 16550A sio7: type 16550A sio8: type 16550A sio9: type 16550A sio10: type 16550A sio11: type 16550A isab0: at device 15.0 on pci0 isa0: on isab0 atapci0: port 0x5c10-0x5c1f,0x374-0x377,0x170-0x177 at device 15.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 pcib1: on motherboard pci1: on pcib1 ahc0: port 0x6000-0x60ff mem 0xfd000000-0xfd000fff irq 9 at device 4.0 on pci1 aic7899: Ultra160 Wide Channel A, SCSI Id=7, 32/253 SCBs ahc1: port 0x6400-0x64ff mem 0xfd001000-0xfd001fff irq 9 at device 4.1 on pci1 aic7899: Ultra160 Wide Channel B, SCSI Id=7, 32/253 SCBs orm0: І`©]1ВI¤F

І`©]1ВI¤F

Ѕц¦b§Й¤WЄє§Ъ¤ЈВ_Єє«дЇБ...µLЄk¤JєО

ёЈ¤¤ҐXІ{Єє¬O¤чҐАїЛЇhѕОЄєЁ­Ей...

§ЪєО¤ЈµЫ...єО¤ЈµЫ.......

ґїёg...§ЪёШ¤U®ь¤f­nЕэҐL­М№L¦n¤й¤l

Ґi¬O·LБЎБ~¤ф«oµLЄkЕэ§Ъјi¦ж©УїХ

ґX­У¤л«e...§Ъ±µДІЁм¤F¤@¤щҐъєР...

µuµuЄє40ґX¤АДБ...§Ъ¬ЭЁм¤F§Ж±ж

§Ъ¤@ЁB¤@ЁBЄє¦b№пЄє¦a¤и¬°®a§V¤O

¦У§ЪЄє©УїХ¤]±N§IІ{

¦pЄG§A¤]·QЕэ®a¤H№L§у¦nЄєҐН¬Ў

ЅРЇd¤Uёк®Ж,§Ъ±N§віo¤щҐъєР±Hµ№§A

§Ъ«OГТ,Ґu­n§A¬ЭАґ¤F,¤@©w·|¬°§A¶}±Т«GДRЄє¤HҐН

©m¦W
©m§O
¦~ДЦ
®a¤¤№qёЬ
¦ж°К№qёЬ
¶l±H¦a§}
¶l»ј°Пё№
ЅР±HЁмpop99917@yahoo.com.tw

To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Tue Feb 25 7:28:23 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B29437B406 for ; Tue, 25 Feb 2003 07:28:21 -0800 (PST) Received: from ip68-100-70-163.nv.nv.cox.net (ip68-100-70-163.nv.nv.cox.net [68.100.70.163]) by mx1.FreeBSD.org (Postfix) with SMTP id DE9A243FAF for ; Tue, 25 Feb 2003 07:28:19 -0800 (PST) (envelope-from hjao@mccinet.ru) From: Элekс To: Freebsd-bugs Reply-To: elexe@seznam.cz Subject: сообщение для Freebsd-bugs Правовая база законодательства России. #6 т.(095) 268-09-65 / 502-54-47 MIME-Version: 1.0 Content-type: text/plain; charset=Windows-1251 Content-Transfer-Encoding: 8bit Message-Id: <20030225152819.DE9A243FAF@mx1.FreeBSD.org> Date: Tue, 25 Feb 2003 07:28:19 -0800 (PST) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Уважаемые господа! Издательство "ЭЛЕКС" (шесть лет работы на российском рынке) предлагает подписку на ежемесячно выходящую на дисках CD-ROM справочную правовую систему "Законодательство России" (федеральный и региональный выпуски). Федеральный выпуск СПС является единственной в России лицензионной правовой базой, которая содержит полный комплект действующих федеральных нормативных правовых актов по всем отраслям права (более 115 тысяч актов) на одном диске CD- ROM. Документы поддерживаются в актуальном состоянии. На диске размещаются также образцы юридических документов, толковый юридический и экономический словарь, библиотечка юриста, бюллетень ВЭД, блок справочной информации, справочник юриста и справочник бухгалтера, бланки квартальной бухгалтерской отчетности и библиография юридических журналов. Региональный выпуск содержит законодательство 15 регионов России (Москвы и Московской области, Краснодарского, Ставропольского, Приморского и Хабаровского краев, Ростовской, Омской, Тюменской, Саратовской, Свердловской, Тверской и Челябинской областей, Ханты - Мансийского и Ямало-Ненецкого автономных округов). Диски работают в локальной сети. Обеспечиваются все виды поиска и редактирования документов, в т. ч. корректный вывод документов и таблиц в формате RTF. Стоимость годовой подписки на любой из дисков (с учетом доставки по почте) - 1620 руб. Подписаться можно на любой срок и с любого месяца. Можно заказать доставку по почте отдельных дисков (стоимость заказа одного диска - 275 руб). Для заказа диска или подписки вышлите Ваш адрес электронный почты или факса, наименование предприятия или ФИО физического лица, а также почтовый адрес для отправки дисков. С нами можно связаться через Internet или по телефонам (095) 268-09-65, 502-54-47. Будем рады ответить на все Ваши вопросы. С уважением и наилучшими пожеланиями генеральный директор Дмитриев В.С. Приносим глубочайшие извинения за беспокойство, если изложенная информация Вас не заинтересовала. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Tue Feb 25 7:54:40 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D55A37B405; Tue, 25 Feb 2003 07:54:39 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B60B243F75; Tue, 25 Feb 2003 07:54:38 -0800 (PST) (envelope-from orion@FreeBSD.org) Received: from freefall.freebsd.org (orion@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1PFscNS011050; Tue, 25 Feb 2003 07:54:38 -0800 (PST) (envelope-from orion@freefall.freebsd.org) Received: (from orion@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1PFsc1Q011046; Tue, 25 Feb 2003 07:54:38 -0800 (PST) Date: Tue, 25 Feb 2003 07:54:38 -0800 (PST) From: Orion Hodson Message-Id: <200302251554.h1PFsc1Q011046@freefall.freebsd.org> To: agapon@cv-nj.com, orion@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/48336: mono audio is played back at double speed Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: mono audio is played back at double speed State-Changed-From-To: open->closed State-Changed-By: orion State-Changed-When: Tue Feb 25 07:51:48 PST 2003 State-Changed-Why: The problem is caused by a bug in the virtual channel code. This is fixed in revisions 1.11 and 1.5.2.4 of ${SRC}/sys/dev/sound/pcm/vchan.c. http://www.freebsd.org/cgi/query-pr.cgi?pr=48336 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Tue Feb 25 7:57: 2 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE33837B401; Tue, 25 Feb 2003 07:57:01 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F7D543F3F; Tue, 25 Feb 2003 07:57:01 -0800 (PST) (envelope-from trhodes@FreeBSD.org) Received: from freefall.freebsd.org (trhodes@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1PFv1NS011166; Tue, 25 Feb 2003 07:57:01 -0800 (PST) (envelope-from trhodes@freefall.freebsd.org) Received: (from trhodes@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1PFv0ln011162; Tue, 25 Feb 2003 07:57:00 -0800 (PST) Date: Tue, 25 Feb 2003 07:57:00 -0800 (PST) From: Tom Rhodes Message-Id: <200302251557.h1PFv0ln011162@freefall.freebsd.org> To: rdm@cfcl.com, trhodes@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: docs/33654: openssl(1) contains many broken SEE ALSO references Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: openssl(1) contains many broken SEE ALSO references State-Changed-From-To: suspended->closed State-Changed-By: trhodes State-Changed-When: Tue Feb 25 07:56:12 PST 2003 State-Changed-Why: nectar has recently created a knob which installs the OpenSSL manual pages. Thanks! http://www.freebsd.org/cgi/query-pr.cgi?pr=33654 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Tue Feb 25 9:30:13 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93CA737B406 for ; Tue, 25 Feb 2003 09:30:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 97F5843FE1 for ; Tue, 25 Feb 2003 09:30:07 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1PHU7NS038366 for ; Tue, 25 Feb 2003 09:30:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1PHU7Al038365; Tue, 25 Feb 2003 09:30:07 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2766B37B40D for ; Tue, 25 Feb 2003 09:28:07 -0800 (PST) Received: from reiher.informatik.uni-wuerzburg.de (wi4d22.informatik.uni-wuerzburg.de [132.187.101.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5465243FCB for ; Tue, 25 Feb 2003 09:28:06 -0800 (PST) (envelope-from mkb@reiher.informatik.uni-wuerzburg.de) Received: by reiher.informatik.uni-wuerzburg.de (Postfix, from userid 1000) id DC35E5C25; Tue, 25 Feb 2003 18:28:14 +0100 (CET) Message-Id: <20030225172814.DC35E5C25@reiher.informatik.uni-wuerzburg.de> Date: Tue, 25 Feb 2003 18:28:14 +0100 (CET) From: Matthias Buelow Reply-To: Matthias Buelow To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48679: (5.0) xterm termcap/info entry seems problematic for some ports Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48679 >Category: bin >Synopsis: (5.0) xterm termcap/info entry seems problematic for some ports >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 25 09:30:07 PST 2003 >Closed-Date: >Last-Modified: >Originator: Matthias Buelow >Release: FreeBSD 5.0-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD reiher.informatik.uni-wuerzburg.de 5.0-RELEASE-p2 FreeBSD 5.0-RELEASE-p2 #0: Sun Feb 23 01:38:51 CET 2003 root@reiher.informatik.uni-wuerzburg.de:/usr/obj/usr/src/sys/REIHER i386 >Description: (FreeBSD 5.0-p2) When TERM=xterm, the nethack program, as built from /games/nethack just exits with: $ nethack Terminal must backspace. This seems to be a problem in the termcap/info entry for "xterm" (proper capability missing?). It did not occur on FreeBSD 4.7. >How-To-Repeat: See above. >Fix: Workaround: set TERM=vt220 for problematic programs. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Tue Feb 25 20:20:16 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA3EE37B401 for ; Tue, 25 Feb 2003 20:20:02 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 217F343F93 for ; Tue, 25 Feb 2003 20:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1Q4K1NS020238 for ; Tue, 25 Feb 2003 20:20:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1Q4K1P8020237; Tue, 25 Feb 2003 20:20:01 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 636BE37B401 for ; Tue, 25 Feb 2003 20:18:11 -0800 (PST) Received: from wetpaper.cra.org (wetpaper.cra.org [198.180.53.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37BB543F3F for ; Tue, 25 Feb 2003 20:18:10 -0800 (PST) (envelope-from jbarker@wetpaper.cra.org) Received: from wetpaper.cra.org (localhost [127.0.0.1]) by wetpaper.cra.org (8.12.3/8.12.3) with ESMTP id h1Q4Htaj063422 for ; Tue, 25 Feb 2003 23:17:55 -0500 (EST) (envelope-from jbarker@wetpaper.cra.org) Received: (from jbarker@localhost) by wetpaper.cra.org (8.12.3/8.12.3/Submit) id h1Q4Hsn2063421; Tue, 25 Feb 2003 23:17:54 -0500 (EST) Message-Id: <200302260417.h1Q4Hsn2063421@wetpaper.cra.org> Date: Tue, 25 Feb 2003 23:17:54 -0500 (EST) From: Jim Barker Reply-To: Jim Barker To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48691: kernel panics on ASUS A7N266-VM Motherboard Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48691 >Category: kern >Synopsis: kernel panics on ASUS A7N266-VM Motherboard >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 25 20:20:00 PST 2003 >Closed-Date: >Last-Modified: >Originator: Jim Barker >Release: FreeBSD 4.7-STABLE i386 >Organization: Not Applicable >Environment: System: FreeBSD bsdut 4.7-STABLE FreeBSD 4.7-STABLE #3: Fri Feb 14 15:56:14 EST 2003 root@bsdut:/usr/obj/usr/src/sys/bsdut i386 Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.7-STABLE #3: Fri Feb 14 15:56:14 EST 2003 root@bsdut:/usr/obj/usr/src/sys/bsdut Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 1994866584 Hz CPU: AMD Athlon(tm) Processor (1994.87-MHz 686-class CPU) Origin = "AuthenticAMD" Id = 0x681 Stepping = 1 Features=0x383fbff AMD Features=0xc0400000 real memory = 536788992 (524208K bytes) avail memory = 516575232 (504468K bytes) Preloaded elf kernel "kernel" at 0xc0572000. Preloaded elf module "linux.ko" at 0xc057209c. Preloaded elf module "nvidia.ko" at 0xc057213c. Pentium Pro MTRR support enabled md0: Malloc disk Using $PIR table, 10 entries at 0xc00f20b0 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 pci0: (vendor=0x10de, dev=0x01ac) at 0.1 pci0: (vendor=0x10de, dev=0x01ad) at 0.2 pci0: (vendor=0x10de, dev=0x01aa) at 0.3 isab0: at device 1.0 on pci0 isa0: on isab0 pci0: (vendor=0x10de, dev=0x01b4) at 1.1 irq 5 ohci0: mem 0xe6800000-0xe6800fff irq 10 at device 2.0 on pci0 usb0: OHCI version 1.0 usb0: SMM does not respond, resetting usb0: on ohci0 usb0: USB revision 1.0 uhub0: (0x10de) OHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 3 ports with 3 removable, self powered ohci1: mem 0xe6000000-0xe6000fff irq 10 at device 3.0 on pci0 usb1: OHCI version 1.0 usb1: on ohci1 usb1: USB revision 1.0 uhub1: (0x10de) OHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub1: 3 ports with 3 removable, self powered pci0: (vendor=0x10de, dev=0x01b0) at 5.0 irq 5 pcm0: port 0xe000-0xe07f,0xe100-0xe1ff irq 11 at device 6.0 on pci0 pcm0: pcib1: at device 8.0 on pci0 pci1: on pcib1 dc0: port 0xc800-0xc8ff mem 0xe4800000-0xe48003ff irq 5 at device 6.0 on pci1 dc0: Ethernet address: 08:00:08:00:08:00 miibus0: on dc0 ukphy0: on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto atapci0: port 0xb800-0xb80f at device 9.0 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 pcib2: at device 30.0 on pci0 pci2: on pcib2 nvidia0: mem 0xe7800000-0xe787ffff,0xe8000000-0xefffffff,0xe3000000-0xe3ffffff irq 11 at device 0.0 on pci2 orm0: Post Message
Приглашаем сотрудников отделов продаж принять участие в тренинге:
 
ТЕЛЕИМИДЖ КОМПАНИИ. ПРОДАЖИ ПО ТЕЛЕФОНУ
11-12  марта 2003 г.
 
Вы узнаете:
 
o        Основные правила общения по телефону, которые нарушать запрещено!
o        Приемы установления контакта с клиентом по телефону.
o        Типичные ошибки в разговоре по телефону.
o        Как разговаривать с будущим клиентом.
o        Что делать, чтобы соответствовать рациональным запросам своих клиентов?
o        Что делать, чтобы соответствовать эмоциональным запросам своих клиентов?
o        Как правильно начать разговор по телефону?
o        Как сознательно владеть голосом, чтобы произвести хорошее впечатление и убедить собеседника?        
o        Слова «раздражители», которые запрещено употреблять.
o        Как избежать начала, заводящего беседу в тупик.
o        Что важно клиенту услышать от Вас, чтобы он сделал свой выбор в вашу пользу?
o        Как строить свое общение, чтобы показать клиенту преимущества Вашего товара или услуг?
o        Как выяснить мотивы покупки, принятия решения?
o        Как мотивировать клиента к покупке?
o        Практические приемы «как снять возражение и оставить хорошее впечатление».
o        Что скрывается за возражением?
o        Самое важное при ответе на возражения.
o        Качественный сервис.
o        Правила, которые делают клиентов постоянными.
o        Презентация коммерческого предложения.
o        Как справляться с неудачами и отказами?
 
         Все приемы и техники будут отработаны  на тренинге под непосредственным руководством опытного тренера. После окончания у Вас и Ваших менеджеров появятся практические навыки эффективных продаж и коммуникаций по телефону.
Автор и ведущий: Салтунов Алексей - Тренер-консультант, действительный член международной ассоциации персональных тренеров (Personal coaches), имеет международный аттестат UNESCO, автор книги "Могущество разума" (готовится к печати), а также курсов на CD. Алексей является одним из первых в России учеников знаменитой Мерилин Аткинсон (Канада). С 1994 года ведет активную практику и в настоящее время является автором более двадцати программ. Разрабатывал и проводил долгосрочную программу по подготовке операторов call-центра одного из крупнейших официальных дилеров АО "АвтоВАЗ". Среди его клиентов такие компании как: "МТУ-Информ", "Сонет", автосалоны Volvo, Audi, Ford, "Интерпочта" и многие др.
 
Стоимость семинара 220 у.е. (с учетом НДС). В стоимость включены кофе-паузы и методический материал.
Зарегистрироваться на семинар и получить любую дополнительную информацию Вы можете по тел. (095) 250-76-39, 748-19-62
 
P.S. ПРИНОСИМ СВОИ ИЗВИНЕНИЯ, ЕСЛИ ДАННАЯ ИНФОРМАЦИЯ НЕ ПРЕДСТАВЛЯЕТ ДЛЯ ВАС ИНТЕРЕСА.
 
Внимание! Отписаться от рассылки можно здесь.
To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Wed Feb 26 19: 4:25 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E3D8137B401; Wed, 26 Feb 2003 19:02:33 -0800 (PST) Received: from notes-relay.monroe.edu (notes-relay.monroe.edu [199.190.222.147]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDFCA43FAF; Wed, 26 Feb 2003 19:02:30 -0800 (PST) (envelope-from vortex_nismo@mail.ru) Received: from mail.greece.k12.ny.us (greece-notes1.greece.k12.ny.us [207.10.14.202]) by notes-relay.monroe.edu (8.12.1/8.12.1) with ESMTP id h1R2wgB8085308; Wed, 26 Feb 2003 21:58:43 -0500 (EST) Received: from hotmail.com ([64.2.84.131]) by mail.greece.k12.ny.us (Lotus Domino Release 5.0.10) with SMTP id 2003022622004652:3595 ; Wed, 26 Feb 2003 22:00:46 -0500 Reply-To: vortex_nismo@mail.ru From: П*О*Л*И*Г*Р*А*Ф*И*Я Subject: -=Оперативная полиграфия по отличным ценам!=- Date: Thu, 27 Feb 2003 04:59:03 +0200 MIME-Version: 1.0 X-Priority: 1 (High) X-MSMail-Priority: High X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-MIMETrack: Itemize by SMTP Server on Greece-Notes1/Greece(Release 5.0.10 |March 22, 2002) at 02/26/2003 10:00:58 PM, Serialize by Router on Greece-Notes1/Greece(Release 5.0.10 |March 22, 2002) at 02/26/2003 10:02:21 PM, Serialize complete at 02/26/2003 10:02:21 PM Message-ID: Content-Transfer-Encoding: 7bit Content-Type: text/html; charset="Windows-1251" To: undisclosed-recipients: ; Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org
 

Наша типография предлагаем Вам услуги оперативной полиграфии по передовой технологии цифровой полноцветной печати (разрешение до 1200dpi) на самом современном оборудовании по ОТЛИЧНЫМ ценам! Цветные и черно-белые визитные карточки, бланки, рекламные листовки, календари, плакаты - любые виды печатной продукции в самые кратчайшие сроки. В офисе работает профессиональный дизайнер, который поможет Вам создать неповторимый стиль и оригинальный дизайн-макет будущей продукции в период Вашего присутствия (от 15 мин до 1,5 часов). Дизайн и изготовление макета - бесплатно!


Прайс-лист на услуги:

Визитные карточки !!!полноцвет!!! (цифровая цветная печать):

 

Тираж

Стоимость тиража ($)

50

7,5

100

9

200

19

500

40

1000

75

* бумага плотностью до 300 г/м2

Визитные карточки (цифровая черно-белая печать):

 

Тираж

Стоимость тиража ($)

50

5

100

7

200

15

500

25

1000

40

* бумага плотностью до 300 г/м2

Плакаты А3:

 

Тираж

Стоимость тиража ($)

1

5

5

20

10

35

50

150


Двусторонние календари:

 

Тираж

Стоимость тиража ($)

50

20

100

35

300

80

 

Цифровая печать любых файлов:

 

По договоренности

 

Изготовление упаковки любых форматов :

По договоренности 

   

Дисконтные карты:

 

Тираж

Стоимость тиража ($)

50

30

100

38

200

50,7

500

110

1000

195

 


Доставка продукции, а также выезд курьера - 100 рублей в пределах МКАД!

Надеемся на дальнейшее долгосрочное сотрудничество!

По всем возникающим вопросам и предложениям о сотрудничестве Вы можете обратиться по телефону:
(095) 275-24-50 (многоканальный).

 

JVBTOWNFXFGPGSJIQCRXPSDMWBJBDNCPBKRKLC To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Wed Feb 26 19:41:11 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D52637B401; Wed, 26 Feb 2003 19:41:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D6F743F3F; Wed, 26 Feb 2003 19:41:10 -0800 (PST) (envelope-from jwd@FreeBSD.org) Received: from freefall.freebsd.org (jwd@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1R3f9NS011722; Wed, 26 Feb 2003 19:41:09 -0800 (PST) (envelope-from jwd@freefall.freebsd.org) Received: (from jwd@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1R3f9C5011718; Wed, 26 Feb 2003 19:41:09 -0800 (PST) Date: Wed, 26 Feb 2003 19:41:09 -0800 (PST) From: "John W. De Boskey" Message-Id: <200302270341.h1R3f9C5011718@freefall.freebsd.org> To: jwd@FreeBSD.org, freebsd-bugs@FreeBSD.org, jwd@FreeBSD.org Subject: Re: misc/18466: install via nfs or ftp media silently truncates long pathname and hence fails Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: install via nfs or ftp media silently truncates long pathname and hence fails Responsible-Changed-From-To: freebsd-bugs->jwd Responsible-Changed-By: jwd Responsible-Changed-When: Wed Feb 26 19:38:31 PST 2003 Responsible-Changed-Why: Take ownership, have tested patch http://www.freebsd.org/cgi/query-pr.cgi?pr=18466 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Wed Feb 26 23:40:10 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B35837B401 for ; Wed, 26 Feb 2003 23:40:07 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A512E43F3F for ; Wed, 26 Feb 2003 23:40:06 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1R7e5NS076920 for ; Wed, 26 Feb 2003 23:40:05 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1R7e5na076919; Wed, 26 Feb 2003 23:40:05 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9BD0A37B401 for ; Wed, 26 Feb 2003 23:37:20 -0800 (PST) Received: from apollo.laserfence.net (apollo.laserfence.net [196.44.69.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BC9A43FDD for ; Wed, 26 Feb 2003 23:37:18 -0800 (PST) (envelope-from will@unfoldings.net) Received: from localhost ([127.0.0.1]) by apollo.laserfence.net with esmtp (Exim 4.10) id 18oIbS-0007Os-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Feb 2003 09:37:15 +0200 Received: from prometheus-p0.datel.laserfence.net ([192.168.255.1] helo=prometheus.home.laserfence.net) by apollo.laserfence.net with esmtp (Exim 4.10) id 18oIbE-0007OW-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Feb 2003 09:37:01 +0200 Received: from phoenix.home.laserfence.net ([192.168.0.2]) by prometheus.home.laserfence.net with esmtp (Exim 4.10) id 18oIbA-0009jC-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Feb 2003 09:36:56 +0200 Received: from will by phoenix.home.laserfence.net with local (Exim 4.10) id 18oIb9-0006H9-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Feb 2003 09:36:55 +0200 Message-Id: Date: Thu, 27 Feb 2003 09:36:55 +0200 From: Willie Viljoen Reply-To: Willie Viljoen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: i386/48738: ForteMedia FM801 chipset based sound cards, pcm(4) not attaching Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48738 >Category: i386 >Synopsis: ForteMedia FM801 chipset based sound cards, pcm(4) not attaching >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 26 23:40:04 PST 2003 >Closed-Date: >Last-Modified: >Originator: Willie Viljoen >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: >Environment: System: FreeBSD phoenix.home.laserfence.net 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #1: Sun Feb 23 10:48:14 SAST 2003 will@phoenix.home.laserfence.net:/usr/obj/usr/src/sys/PHOENIX i386 >Description: Since some time during the development of 4.6-STABLE, this device has not been attatched by the pcm(4) driver. In the output from dmesg, it is also not properly recognized as had been the case before: pci0: (vendor=0x1319, dev=0x0801) at 10.0 irq 9 pci0: (vendor=0x1319, dev=0x0802) at 10.1 At first I assumed the device to be deffective and continued with my old SB16 instead, but a post to freebsd-questions where the poster has trouble with this card on new systems, but not on 4.5-RELEASE, caught my attention. For refference, I include his post below: I have installed 5.0-RELEASE and have a trouble to configure my Genius Sound Maker Live soundcard based on ForteMedia 801 chip I'm added next line to KERNELCONFIG file: device pcm and... and nothing changed... when booting it just saying: pcib1: at device 1.0 on pci0 pci1: on pcib1 pci1: at device 0.0 (no driver attached) pcib2: at device 30.0 on pci0 pci2: on pcib2 pci2: at device 11.0 (no driver attached) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pci2: at device 11.1 (no driver attached) than I added next line to loader.conf snd_pcm_load="YES" snd_fm801_load="YES" result was the same.... And I tried to switch off PNP OS Installed in BIOS... What i'm doing wrong? The card is worked fine under 4.5-RELEASE. This indicates to me that the problem must have occured after 4.5, and is manifested in both 4-STABLE and 5-CURRENT. >How-To-Repeat: Use a system with a sound device based on the FM801 chipset, build kernel with pcm(4) >Fix: Not known. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 2:30: 8 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E88B037B401 for ; Thu, 27 Feb 2003 02:30:07 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7DE4943FA3 for ; Thu, 27 Feb 2003 02:30:07 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RAU7NS024891 for ; Thu, 27 Feb 2003 02:30:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RAU7qF024890; Thu, 27 Feb 2003 02:30:07 -0800 (PST) Date: Thu, 27 Feb 2003 02:30:07 -0800 (PST) Message-Id: <200302271030.h1RAU7qF024890@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Attila Nagy Subject: Re: kern/46720: This is the result of Netgraph FEC, tcpdump running and an ICMP ping to the host. Reply-To: Attila Nagy Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/46720; it has been noted by GNATS. From: Attila Nagy To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: kern/46720: This is the result of Netgraph FEC, tcpdump running and an ICMP ping to the host. Date: Thu, 27 Feb 2003 11:29:19 +0100 (CET) Hello, This PR can be closed, wpaul committed two fixes. The first makes this panic go away, the second makes ng_fec working. Thanks! ----------[ Free Software ISOs - http://www.fsn.hu/?f=download ]---------- Attila Nagy e-mail: Attila.Nagy@fsn.hu Free Software Network (FSN.HU) phone @work: +361 210 1415 (194) cell.: +3630 306 6758 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 3: 3:58 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EBAC537B405; Thu, 27 Feb 2003 03:03:57 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A6EA43F93; Thu, 27 Feb 2003 03:03:57 -0800 (PST) (envelope-from maxim@FreeBSD.org) Received: from freefall.freebsd.org (maxim@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RB3vNS033396; Thu, 27 Feb 2003 03:03:57 -0800 (PST) (envelope-from maxim@freefall.freebsd.org) Received: (from maxim@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RB3vA6033392; Thu, 27 Feb 2003 03:03:57 -0800 (PST) Date: Thu, 27 Feb 2003 03:03:57 -0800 (PST) From: Maxim Konovalov Message-Id: <200302271103.h1RB3vA6033392@freefall.freebsd.org> To: bra@fsn.hu, maxim@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/46720: This is the result of Netgraph FEC, tcpdump running and an ICMP ping to the host. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: This is the result of Netgraph FEC, tcpdump running and an ICMP ping to the host. State-Changed-From-To: open->closed State-Changed-By: maxim State-Changed-When: Thu Feb 27 03:02:27 PST 2003 State-Changed-Why: wpaul fixed ng_fec in -CURRENT. http://www.freebsd.org/cgi/query-pr.cgi?pr=46720 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 5: 0:31 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78EE537B401 for ; Thu, 27 Feb 2003 05:00:28 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 713D143FE0 for ; Thu, 27 Feb 2003 05:00:27 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RD0RNS068027 for ; Thu, 27 Feb 2003 05:00:27 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RD0Rjd068026; Thu, 27 Feb 2003 05:00:27 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4214337B401 for ; Thu, 27 Feb 2003 04:53:44 -0800 (PST) Received: from mpool.st.simbirsk.su (mpool.vinf.ru [213.242.40.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4058943FCB for ; Thu, 27 Feb 2003 04:53:41 -0800 (PST) (envelope-from alexd@orlando.vinf.ru) Received: from orlando.vinf.ru (root@orlando.vinf.ru [213.242.40.138]) by mpool.st.simbirsk.su (8.11.2-MVC-VI/8.11.2) with ESMTP id h1RCrZE14678; Thu, 27 Feb 2003 15:53:36 +0300 (MSK) (envelope-from alexd@orlando.vinf.ru) Received: from orlando.vinf.ru (alexd@localhost [127.0.0.1]) by orlando.vinf.ru (8.12.6/8.11.4) with ESMTP id h1RCrZnt006554; Thu, 27 Feb 2003 15:53:35 +0300 (MSK) (envelope-from alexd@orlando.vinf.ru) Received: (from alexd@localhost) by orlando.vinf.ru (8.12.6/8.12.6/Submit) id h1RCrYU2006553; Thu, 27 Feb 2003 15:53:34 +0300 (MSK) Message-Id: <200302271253.h1RCrYU2006553@orlando.vinf.ru> Date: Thu, 27 Feb 2003 15:53:34 +0300 (MSK) From: "Alex L. Demidov" Reply-To: "Alex L. Demidov" To: FreeBSD-gnats-submit@FreeBSD.org Cc: alexd@vinf.ru X-Send-Pr-Version: 3.113 Subject: kern/48741: ipnat corrupts packets on gre interface with rules Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48741 >Category: kern >Synopsis: ipnat corrupts packets on gre interface with rules >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 05:00:26 PST 2003 >Closed-Date: >Last-Modified: >Originator: Alex L. Demidov >Release: FreeBSD 4.7-STABLE i386 >Organization: Variant-Inform ISP >Environment: System: FreeBSD orlando.vinf.ru 4.7-STABLE FreeBSD 4.7-STABLE #13: Tue Jan 21 20:29:38 MSK 2003 root@orlando.vinf.ru:/.ftp/obj/.src/src/sys/ORLANDO i386 >Description: When using ipnat rules for redirecting packets incoming on gre interface, ipnat replaces destination ip:port pair (right) and swaps destination ip:port with source ip:port (?!). >How-To-Repeat: initialize gre tunnel initialize ipnat $ echo 'rdr gre0 0.0.0.0/0 port 80 -> ${server} port 3128 tcp' > ipnat.rules $ ipnat -CF -f ipnat.rules generate some traffice from host ${client} incoming to gre interface with destination port = 80. $ tcpdump -v -i gre0 src host ${client} and dst port 80 and another instance of tcpdump $ tcpdump -v -i ${primary_interface} src host ${server} and src port 3128 and dst host ${client} You will see something like I captured today: gre0: 1:50:31.024708 ${client}.4867 > ${somehost}.http: S [tcp sum ok] 2382677246:2382677246(0) win 8760 (DF) (ttl 125, id 60400, len 48) xl0: 01:50:31.024771 ${server}.3128 > ${client}.4867: S [tcp sum ok] 175447728:175447728(0) ack 2382677247 win 57344 (DF) (ttl 64, id 6641, len 44, bad cksum 0!) gre0: 01:50:33.989896 ${client}.4867 > ${somehost}.http: S [tcp sum ok] 2382677246:2382677246(0) win 8760 (DF) (ttl 125, id 60402, len 48) xl0: 1:50:33.989953 ${server}.3128 > ${client}.4867: S [tcp sum ok] 175447728:175447728(0) ack 2382677247 win 57344 (DF) (ttl 64, id 6661, len 44, bad cksum 0!) >Fix: Don't know. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 6: 0:33 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A861937B401 for ; Thu, 27 Feb 2003 06:00:31 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54CEA43F75 for ; Thu, 27 Feb 2003 06:00:31 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RE0VNS091259 for ; Thu, 27 Feb 2003 06:00:31 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RE0U1o091258; Thu, 27 Feb 2003 06:00:30 -0800 (PST) Date: Thu, 27 Feb 2003 06:00:30 -0800 (PST) Message-Id: <200302271400.h1RE0U1o091258@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Maxim Konovalov Subject: Re: kern/48717: ipfw2 probability is wrong Reply-To: Maxim Konovalov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/48717; it has been noted by GNATS. From: Maxim Konovalov To: Alex Popa Cc: bug-followup@freebsd.org Subject: Re: kern/48717: ipfw2 probability is wrong Date: Thu, 27 Feb 2003 16:53:05 +0300 (MSK) Please try a patch below instead. Index: ipfw/ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.4.2.10 diff -u -r1.4.2.10 ipfw2.c --- ipfw/ipfw2.c 14 Jan 2003 19:15:59 -0000 1.4.2.10 +++ ipfw/ipfw2.c 27 Feb 2003 13:47:57 -0000 @@ -865,7 +865,7 @@ ipfw_insn_u32 *p = (ipfw_insn_u32 *)cmd; double d = 1.0 * p->d[0]; - d = 1 - (d / 0x7fffffff); + d = d / 0x7fffffff; printf("prob %f ", d); } break; @@ -2521,8 +2521,7 @@ if (d != 1) { /* 1 means always match */ action->opcode = O_PROB; action->len = 2; - *((int32_t *)(action+1)) = - (int32_t)((1 - d) * 0x7fffffff); + *((int32_t *)(action+1)) = (int32_t)(d * 0x7fffffff); action += action->len; } av += 2; ac -= 2; %%% -- Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 7:10:12 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B343737B405 for ; Thu, 27 Feb 2003 07:10:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8949D43F93 for ; Thu, 27 Feb 2003 07:10:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RFA9NS028150 for ; Thu, 27 Feb 2003 07:10:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RFA9sH028147; Thu, 27 Feb 2003 07:10:09 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 913C337B401 for ; Thu, 27 Feb 2003 07:02:03 -0800 (PST) Received: from redhotmomma.ssr.com (ns.ssr.com [199.4.235.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 6C15E43F85 for ; Thu, 27 Feb 2003 07:02:02 -0800 (PST) (envelope-from sdb@ssr.com) Received: (qmail 12135 invoked from network); 27 Feb 2003 15:01:57 -0000 Received: from kimchee.ssr.com (199.4.235.5) by ns.ssr.com with QMQP; 27 Feb 2003 15:01:57 -0000 Message-Id: <20030227150157.2062.qmail@kimchee.ssr.com> Date: 27 Feb 2003 15:01:57 -0000 From: Scott Ballantyne Reply-To: Scott Ballantyne To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48748: vipw doesn't handle EDITOR='emacs -nw' properly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48748 >Category: bin >Synopsis: vipw doesn't handle EDITOR='emacs -nw' properly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 07:10:09 PST 2003 >Closed-Date: >Last-Modified: >Originator: Scott Ballantyne >Release: FreeBSD 4.7-RELEASE i386 >Organization: ScotSoft Research >Environment: System: FreeBSD kimchee.ssr.com 4.7-RELEASE FreeBSD 4.7-RELEASE #4: Mon Jan 13 07:29:39 EST 2003 sdb@kimchee.ssr.com:/usr/src/sys/compile/KIMCHEE i386 >Description: pw_edit (called by vipw) does not properly handle EDITOR environment variables where the editor is specified with additional arguments. >How-To-Repeat: EDITOR='emacs -nw' vipw >Fix: The easy fix is to use sh to execute the editor variable. Otherwise, have to parse the arguments and add them to the execlp call. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 7:20:13 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB49237B405 for ; Thu, 27 Feb 2003 07:20:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A26943FDD for ; Thu, 27 Feb 2003 07:20:11 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RFKANS075264 for ; Thu, 27 Feb 2003 07:20:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RFKAXJ075263; Thu, 27 Feb 2003 07:20:10 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E02B37B401 for ; Thu, 27 Feb 2003 07:19:34 -0800 (PST) Received: from redhotmomma.ssr.com (ns.ssr.com [199.4.235.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 634D943F3F for ; Thu, 27 Feb 2003 07:19:33 -0800 (PST) (envelope-from sdb@ssr.com) Received: (qmail 29961 invoked from network); 27 Feb 2003 15:18:57 -0000 Received: from kimchee.ssr.com (199.4.235.5) by ns.ssr.com with QMQP; 27 Feb 2003 15:18:57 -0000 Message-Id: <20030227151857.2180.qmail@kimchee.ssr.com> Date: 27 Feb 2003 15:18:57 -0000 From: Scott Ballantyne Reply-To: Scott Ballantyne To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48749: inetd depends on portmap Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48749 >Category: bin >Synopsis: inetd depends on portmap >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 07:20:10 PST 2003 >Closed-Date: >Last-Modified: >Originator: Scott Ballantyne >Release: FreeBSD 4.7-RELEASE i386 >Organization: ScotSoft Research >Environment: System: FreeBSD kimchee.ssr.com 4.7-RELEASE FreeBSD 4.7-RELEASE #4: Mon Jan 13 07:29:39 EST 2003 sdb@kimchee.ssr.com:/usr/src/sys/compile/KIMCHEE i386 >Description: If inetd is enabled without enabling portmap on an install, mysterious failures on non-rpc services can result since while inetd is waiting for the portmapper response it won't service other requests. Enable inetd without enabling amd or being an nfs server (i.e., nfs client only). >How-To-Repeat: Enable inetd without enabling amd or becoming an nfs server (nfs client only, for example). Uncomment (as an example) ftpd or talkd and (for example) rstatd rusersd. HUP inetd. talkd will fail since it cannot connect to local daemon. After a while, it will work. Then it will fail again. >Fix: Add chkdepend inetd inetd_enable portmap portmap_enable to /etc/rc. Or add a comment to the appropriate place in the inetd.conf file for morons like me:-) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 10:10: 4 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 27C4A37B401 for ; Thu, 27 Feb 2003 10:10:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C74A043F75 for ; Thu, 27 Feb 2003 10:10:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RIA2NS023171 for ; Thu, 27 Feb 2003 10:10:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RIA2dh023170; Thu, 27 Feb 2003 10:10:02 -0800 (PST) Date: Thu, 27 Feb 2003 10:10:02 -0800 (PST) Message-Id: <200302271810.h1RIA2dh023170@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Eirik Oeverby Subject: Re: misc/44044: 4.7-R Freezes half the times snd.ko is loaded (Creative SB live EMU10K) Reply-To: Eirik Oeverby Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/44044; it has been noted by GNATS. From: Eirik Oeverby To: freebsd-gnats-submit@FreeBSD.org, krask@mediac.dk Cc: Subject: Re: misc/44044: 4.7-R Freezes half the times snd.ko is loaded (Creative SB live EMU10K) Date: Thu, 27 Feb 2003 19:10:50 +0100 Hi, I can confirm this bug. On my system, I am totally unable to ever load the snd_emu10k1 driver. I get the same symptoms (with the same console message, only different IRQ and device/bus IDs) every time I try. My system is a IBM ThinkPad T21 plugged into an IBM docking station that has a PCI slot with a SB Live! installed. It works flawlessly under OS/2, Linux and various Windows flavours. The only problem I can recall on other platforms showed up during development of the OS/2 driver, where it failed to detect the SB Live! because of the high PCI bus ID (>16), the driver simply didn't scan all buses. This did not cause a lockup or any other erratic behaviour other than the card not being identified. Best regards, Eirik Oeverby To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 11: 0:30 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E533C37B405 for ; Thu, 27 Feb 2003 11:00:27 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87CFC43FD7 for ; Thu, 27 Feb 2003 11:00:24 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RJ0ONS034316 for ; Thu, 27 Feb 2003 11:00:24 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RJ0OoC034315; Thu, 27 Feb 2003 11:00:24 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CE9F37B401 for ; Thu, 27 Feb 2003 10:58:24 -0800 (PST) Received: from reiher.informatik.uni-wuerzburg.de (wi4d22.informatik.uni-wuerzburg.de [132.187.101.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9981343FA3 for ; Thu, 27 Feb 2003 10:58:23 -0800 (PST) (envelope-from mkb@reiher.informatik.uni-wuerzburg.de) Received: by reiher.informatik.uni-wuerzburg.de (Postfix, from userid 1000) id 0CD185C3D; Thu, 27 Feb 2003 19:58:33 +0100 (CET) Message-Id: <20030227185833.0CD185C3D@reiher.informatik.uni-wuerzburg.de> Date: Thu, 27 Feb 2003 19:58:33 +0100 (CET) From: Matthias Buelow Reply-To: Matthias Buelow To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48755: 5.0-p2 kernel panic probably filesystem related Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48755 >Category: kern >Synopsis: 5.0-p2 kernel panic probably filesystem related >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 11:00:23 PST 2003 >Closed-Date: >Last-Modified: >Originator: Matthias Buelow >Release: FreeBSD 5.0-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD reiher.informatik.uni-wuerzburg.de 5.0-RELEASE-p2 FreeBSD 5.0-RELEASE-p2 #0: Sun Feb 23 01:38:51 CET 2003 root@reiher.informatik.uni-wuerzburg.de:/usr/obj/usr/src/sys/REIHER i386 >Description: Got a panic right now on 5.0-p2/i386, probably related to filesystem stuff: # gdb -k /boot/kernel/kernel ./vmcore.0 GNU gdb 5.2.1 (FreeBSD) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-undermydesk-freebsd"...(no debugging symbols found)... panic: bwrite: buffer is not busy??? panic messages: --- panic: pmap_enter: attempted pmap_enter on 4MB page syncing disks, buffers remaining... panic: bwrite: buffer is not busy??? Uptime: 17h3m21s Dumping 511 MB ata0: resetting devices .. done 16 32[CTRL-C to abort] 48 64 80 96 112 128 144 160 176 192 208 224 240 256 272 288 304 320 336 352 368 384 400 416 432 448[CTRL-C to abort] 464 480 496 --- #0 0xc01de84b in doadump () (kgdb) bt #0 0xc01de84b in doadump () #1 0xc01decd6 in boot () #2 0xc01def23 in panic () #3 0xc021d692 in bwrite () #4 0xc021ec4e in vfs_bio_awrite () #5 0xc02ca63a in ffs_fsync () #6 0xc02c987e in ffs_sync () #7 0xc023070b in sync () #8 0xc01de94c in boot () #9 0xc01def23 in panic () #10 0xc031afed in pmap_enter () #11 0xc02dc8d4 in vm_fault () #12 0xc031e45f in trap_pfault () #13 0xc031df52 in trap () #14 0xc030f048 in calltrap () ---Can't read userspace from dump, or kernel process--- I'll keep the crashdump for a while, in case someone wants to extract some more info. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 11:11:39 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8692137B401; Thu, 27 Feb 2003 11:11:38 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BBF743F75; Thu, 27 Feb 2003 11:11:38 -0800 (PST) (envelope-from luoqi@FreeBSD.org) Received: from freefall.freebsd.org (luoqi@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RJBcNS042026; Thu, 27 Feb 2003 11:11:38 -0800 (PST) (envelope-from luoqi@freefall.freebsd.org) Received: (from luoqi@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RJBb5i042022; Thu, 27 Feb 2003 11:11:37 -0800 (PST) Date: Thu, 27 Feb 2003 11:11:37 -0800 (PST) From: Luoqi Chen Message-Id: <200302271911.h1RJBb5i042022@freefall.freebsd.org> To: q@uni.de, luoqi@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/41747: quake won't play sound with newpcm driver Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: quake won't play sound with newpcm driver State-Changed-From-To: open->closed State-Changed-By: luoqi State-Changed-When: Thu Feb 27 11:10:19 PST 2003 State-Changed-Why: Problem solved. http://www.freebsd.org/cgi/query-pr.cgi?pr=41747 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:10:16 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88CFA37B401 for ; Thu, 27 Feb 2003 14:10:13 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A5F0043FB1 for ; Thu, 27 Feb 2003 14:10:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RMACNS090826 for ; Thu, 27 Feb 2003 14:10:12 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RMACQE090825; Thu, 27 Feb 2003 14:10:12 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7272437B401 for ; Thu, 27 Feb 2003 14:02:28 -0800 (PST) Received: from unia.3lo.lublin.pl (unia.3lo.lublin.pl [212.182.70.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 21ACC43FD7 for ; Thu, 27 Feb 2003 14:02:27 -0800 (PST) (envelope-from pawmal@unia.3lo.lublin.pl) Received: (qmail 56540 invoked by uid 1007); 27 Feb 2003 22:03:47 -0000 Message-Id: <20030227220347.56539.qmail@unia.3lo.lublin.pl> Date: 27 Feb 2003 22:03:47 -0000 From: Pawel Malachowski Reply-To: Pawel Malachowski To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48758: kldunload if_{nic} can cause kernel panic Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48758 >Category: kern >Synopsis: kldunload if_{nic} can cause kernel panic >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 14:10:12 PST 2003 >Closed-Date: >Last-Modified: >Originator: Paweі Maіachowski >Release: FreeBSD 4.7-STABLE i386 >Organization: ASK ZiN >Environment: System: FreeBSD unia.3lo.lublin.pl 4.7-STABLE FreeBSD 4.7-STABLE #1: Wed Nov 27 22:08:42 CET 2002 root@unia.3lo.lublin.pl:/usr/src/sys/compile/UNIA i386 >Description: If I unload if_xl.ko while arpwatch or trafshow is listening on, kernel panic happens: xl0: promiscuous mode disabled xlphy0: detached miibus1: detached xl0: detached Fatal trap 12: page fault while in kernel mode fault virtual address = 0xc6f602f0 fault code = supervisor read, page not present instruction pointer = 0x8:0xc6f602f0 stack pointer = 0x10:0xd3308f7c frame pointer = 0x10:0xd3308f9c code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 161 (darkstat) interrupt mask = trap number = 12 panic: page fault syncing disks... 3 1 done Uptime: 24m43s I've tried this on two different machines running 4.7-RELEASE and 4.8-PRELEASE, with if_fxp and if_xl. It *always* crashes here: #6 0xc6f602f0 in ?? () #7 0xc02d4403 in doreti_swi () When I try this with tcpdump instead of arpwatch, it hangs (only Caps/Num/Scroll Lock LED-s are working) without kernel panic. >How-To-Repeat: Let's say, we have 3Com 905B NIC and xl is not compiled in kernel but acts as a module. kldload if_xl ifconfig xl0 inet add 192.168.0.1/24 (now run trafshow, arpwatch or tcpdump with -i xl0) kldunload if_xl And system will crash. >Fix: Unknown. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:21:30 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EFFB37B401 for ; Thu, 27 Feb 2003 14:21:29 -0800 (PST) Received: from cedu.com (mail.cedu.com [65.171.153.202]) by mx1.FreeBSD.org (Postfix) with SMTP id 1652C43F85 for ; Thu, 27 Feb 2003 14:21:28 -0800 (PST) (envelope-from cblanchard@cedu.com) Received: from ESG_DOM-Message_Server by cedu.com with Novell_GroupWise; Thu, 27 Feb 2003 14:20:05 -0800 Message-Id: X-Mailer: Novell GroupWise Internet Agent 5.5.3.1 Date: Thu, 27 Feb 2003 14:19:58 -0800 From: "Christopher Blanchard" To: Subject: Berekley Users Group Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org I tried to use the msg form to send them a message and got: You don't have permission to access /buug/mail.cgi on this server. I thought you might be able to let them know. If you would, please pass this on to someone appropriate. I am a system administrator at a small private school in the California= mountains. I recently acquired a dsl connection and would like to share = it with the faculty and staff. I put up a 4.7 stable dual-homed box = (AJAX), rebuilt the kernel with IPFIREWALL, IPFIREWALL_DEFAULT_TO_ACCEPT = and IPDIVERT. The dsl gateway is 4.63.122.77/255.255.255.252 the = interface is 4.63.122.78/255.255.255.252 on the LAN side the interface is = 10.10.236.5/255.255.255.0 and another router is at 10.10.236.254, 10.10.2 = 36.1 is a dns/dhcp server (RS1)(novell netware) cedulocal.com. I have = read everything I can get my hands on but cannot get AJAX to pass traffic. = I would be appreciative of suggestions and would particularly like sample = rc.files with appropriate examples. X-server on this machine will not = work as it is a compaq with an embedded Intel 82815e graphics which I am = unable to turn off. thanks To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:28:21 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A0F137B401 for ; Thu, 27 Feb 2003 14:28:15 -0800 (PST) Received: from host-35-232-220-24.midco.net (host-35-232-220-24.midco.net [24.220.232.35]) by mx1.FreeBSD.org (Postfix) with SMTP id 11DE343FD7 for ; Thu, 27 Feb 2003 14:27:14 -0800 (PST) (envelope-from gukehwy@yandex.ru) From: (095) 411-02-32 To: Freebsd-bugs Subject: Деловой Английский/Toefl овладейте за 2 месяца QDgecAM0tL MIME-Version: 1.0 Content-type: text/html; charset=Windows-1251 Content-Transfer-Encoding: 8bit Message-Id: <20030227222714.11DE343FD7@mx1.FreeBSD.org> Date: Thu, 27 Feb 2003 14:27:14 -0800 (PST) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org T I T L E
Интенсивный 2 месячный бизнес супер-курс 2003 American Business Center     238-3386 / 778-9894 Moscow

Наверное не стоит говорить о том, насколько важно для путешествующего бизнесмена знать ежедневно используемый язык делового мира той страны, в которую он приехал, иначе добиться успеха практически невозможно.

Предлагаем вашему вниманию супер бизнес программу!
  • Курс профессионального делового языка (3 уровня)
  • (для начинающих (1+), средний и продвинутый уровни)
  • Менеджмент
  • Бизнес юриспруденция
  • Финансы
Занятия проходят в деловых группах, возможны также частные уроки с выездом в офис или домой.

Наш наиболее популярный курс делового языка предлагает широчайший спектр самых свежих и актуальных экономических тематик. Первоочередная задача обучения ориентирована, главным образом, на развитие разговорных навыков, умения общаться и осуществлять переговоры с иностранными партнерами на профессиональном уровне.

Гибкий трафик занятий по два, три раза в неделю по два астрономических часа на ваш выбор.

Также проводим бесплатное тестирование заинтересованных лиц и подробно знакомим их с нашей программой.
УНИВЕРСАЛЬНЫЙ ДЕЛОВОЙ ЯЗЫК, ИДИОМЫ И ЛЕКСИКА:
0101 Каждая общественная группа разговаривает на своем уникальном языке (например, лксика, используемая врачами, техниками, юристами, политиками, работниками ресторанов и т.д.), который пересекает языковые барьеры и широко используется почти в каждой американской фирме. Любой, кто занимается бизнесом в США должен знать или изучить приведенные ниже термины, поскольку с ними ему придется встретиться сразу же, как только он начнет разговаривать с первым, встретившим его в фирме, сотрудником.
ЛЕКСИКА ОФИЦИАЛЬНЫХ ДЕЛОВЫХ ВСТРЕЧ:
0202 Многие фирмы, как правило, устраивают официальные встречи, вечера, ужины, которые имеют своей целью общение с клиентурой, повышение морального духа сотрудников и установление новых деловых контактов. Поскольку подобные мероприятия преследуют не только деловые цели, но и являются средством отдыха и развлечения, существуют два вида языка, использующихся на этих встречах.
ФИНАНСОВЫЙ ЯЗЫК И ЛЕКСИКА:
0303 Существует много терминов и выражений, относящихся к денежному обращени. и финансам, причем эти выражения широко используются всеми группами населения. Однако, существует и дополнительная, не всегда доступная для понимания лексика, используемая главным образом профессионалами в области финансов, экономики, банковского дела и бухгалтерии.
ЯЗЫК, ИСПОЛЬЗУЕМЫЙ В ОТДЕЛЬНЫХ ВИДАХ СПОРТА И ВСТРЕЧАЮЩИЙСЯ В РАЗГОВОРЕ АМЕРИКАНСКИХ БИЗНЕСМЕНОВ:
0404 Бейсбол, баскетбол, бокс, футбол (американский), скачки, парусный спорт, плавание, теннис и легкая атлетика. Спорт дал рождение большлму количеству языковых выражений не только в области самого спорта, но и в повседневном разговоре людей, которые не имеют к спорту никакого отношения.
ШИРОКО РАСПРОСТРАНЕННЫЕ АББРЕВИАТУРЫ, ОТНОСЯЩИЕСЯ К ФИНАНСАМ:
0505 Наиболее распространненных инициал и аббревиатур, известных практически всем, кто имеет дело с деньгами и финансами.
РЕКЛАМНАЯ ЛЕКСИКА И ЯЗЫК:
0606 Поскольку реклама становится все более творческой, умной и неповторимой, можно предположить, что и лексика в этой области является довольно выразительной. Приводятся наиболее распространенные термины известные всем, кто бывает на Мэдисон Авеню.
ЛЕКСИКА МАРКЕТИНГА:
0707 Почти что все термины, которые вам понадобятся, для вступления в мир маркетинга. Куда бы мы не пошли, мы повсюду окружены различными формами маркетинга, от листовок до плакатов на улицах, от благодарственных писем до звонких стишков, от разговорных фраз до текстов, выписываемых в небе самолетами. Именно потому, что каждый прием в маркетинге имеет свое обозначение, для непосвященного в это многое кажется почти не имеющим смысла и излишним. Многие из терминов образованы от ярких художественных образов. Что, например, может означать такое выражение, как "корова с колокольчиком", "отзвук выстрела" или "боковик"?
ЯЗЫК И ЛЕКСИКА ДЕЛОВЫХ ПОЕЗДОК:
0808 Термины являются знакомыми не только любому американскому бизнесмену-путешественнику, но и каждому. кто едет в отпуск, планирует путешествие или просто провожает кого-нибудь в аэропорту.
ЛЕКСИКА, ОТНОСЯЩАЯСЯ К ПЕРЕГОВОРАМ:
0909 Не следует, вероятно, особенно подчеркивать тот факт, что всякий, для которого незнаком язык переговоров, всегда оказывается в необычном, зачастую весьма тяжелом положении. Без понимания особого языка переговоров важные дискуссии и соглашения могут поняты превратно.
СЛОВА МИТИНГОВ И ВСТРЕЧ:
1010 Существует ряд терминов и идиом, которые обычно используются на митингах и встречах.
КОМПЬЮТЕРНЫЙ ЯЗЫК И ЛЕКСИКА:
1111 Каждый, кто когда-нибудь принимал решение о покупке персонального компьютера, непрерывно попадал в среду рекламных объявлений, компьютерных фанатов, торговцев и других личностей, которые говорили на малопонятном техническом языке, кажущимся каким-то другим языком. На самом же деле, это тайный язык, линго, является продуктом тех, кто производит компьютерную технику и кто полагает, что чем более сложна компьютерная терминология, тем желаннее будет выглядеть их продукция в глазах покупателя.
ИНТЕНСИВНЫЙ 2 МЕСЯЧНЫЙ TOEFL КУРС:
1212 Мы помогаем студентам эффективно сдать экзамен TOEFL, пройти собеседование в иностранной компании или для эмиграции в США, Канаду, Австралию.
   НОВИНКА!
Натурализация текстов на английском и деловая переписка, подбор экспертов/импортеров для Российских компаний, перевод и ведение деловых переговоров. AMERICAN BUSINESS CENTER238-3386/778-9894 Moscow
To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:29:17 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 872F737B401 for ; Thu, 27 Feb 2003 14:29:15 -0800 (PST) Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD5A643FF3 for ; Thu, 27 Feb 2003 14:28:57 -0800 (PST) (envelope-from DougB@freebsd.org) Received: from master.gorean.org (12-234-22-23.client.attbi.com[12.234.22.23]) by rwcrmhc53.attbi.com (rwcrmhc53) with SMTP id <20030227222857053001t87te>; Thu, 27 Feb 2003 22:28:57 +0000 Date: Thu, 27 Feb 2003 14:28:56 -0800 (PST) From: Doug Barton To: Christopher Blanchard Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: Berekley Users Group In-Reply-To: Message-ID: <20030227142603.E8428@znfgre.tberna.bet> References: Organization: http://www.FreeBSD.org/ X-message-flag: Outlook -- Not just for spreading viruses anymore! MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Ok, step one, you should really post this to freebsd-questions@freebsd.org. That said, it sounds like you're trying to use NAT to share the link, is that correct? If so, have you read the natd man page? It describes what you need to do in order to get this working. If you're still having problems after that, send your info to -questions. Good luck, Doug On Thu, 27 Feb 2003, Christopher Blanchard wrote: > I tried to use the msg form to send them a message and got: > You don't have permission to access /buug/mail.cgi on this server. > I thought you might be able to let them know. > > If you would, please pass this on to someone appropriate. > > I am a system administrator at a small private school in the > California mountains. I recently acquired a dsl connection and would > like to share it with the faculty and staff. I put up a 4.7 stable > dual-homed box (AJAX), rebuilt the kernel with IPFIREWALL, > IPFIREWALL_DEFAULT_TO_ACCEPT and IPDIVERT. The dsl gateway is > 4.63.122.77/255.255.255.252 the interface is 4.63.122.78/255.255.255.252 > on the LAN side the interface is 10.10.236.5/255.255.255.0 and another > router is at 10.10.236.254, 10.10.2 36.1 is a dns/dhcp server > (RS1)(novell netware) cedulocal.com. I have read everything I can get > my hands on but cannot get AJAX to pass traffic. I would be > appreciative of suggestions and would particularly like sample rc.files > with appropriate examples. X-server on this machine will not work as it > is a compaq with an embedded Intel 82815e graphics which I am unable to > turn off. thanks > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-bugs" in the body of the message > > -- This .signature sanitized for your protection To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:30:32 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B6C037B401 for ; Thu, 27 Feb 2003 14:30:29 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 28E5843FBF for ; Thu, 27 Feb 2003 14:30:08 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RMU7NS095388 for ; Thu, 27 Feb 2003 14:30:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RMU7vn095387; Thu, 27 Feb 2003 14:30:07 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2086937B401 for ; Thu, 27 Feb 2003 14:21:04 -0800 (PST) Received: from unia.3lo.lublin.pl (unia.3lo.lublin.pl [212.182.70.2]) by mx1.FreeBSD.org (Postfix) with SMTP id E004E43F75 for ; Thu, 27 Feb 2003 14:21:02 -0800 (PST) (envelope-from pawmal@unia.3lo.lublin.pl) Received: (qmail 56788 invoked by uid 1007); 27 Feb 2003 22:22:22 -0000 Message-Id: <20030227222222.56787.qmail@unia.3lo.lublin.pl> Date: 27 Feb 2003 22:22:22 -0000 From: Pawel Malachowski Reply-To: Pawel Malachowski To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48759: kldstat shows module after unsuccessfull kldload Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48759 >Category: kern >Synopsis: kldstat shows module after unsuccessfull kldload >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 14:30:07 PST 2003 >Closed-Date: >Last-Modified: >Originator: Paweі Maіachowski >Release: FreeBSD 4.7-STABLE i386 >Organization: ASK ZiN >Environment: System: FreeBSD unia.3lo.lublin.pl 4.7-STABLE FreeBSD 4.7-STABLE #1: Wed Nov 27 22:08:42 CET 2002 root@unia.3lo.lublin.pl:/usr/src/sys/compile/UNIA i386 >Description: Loading of driver.ko fails (because it was previously linked with kernel), but driver.ko is now shown by kldstat. >How-To-Repeat: Try to load a module that is known to be compiled in kernel. % grep gif /usr/src/sys/i386/conf/THISPCCONFIG pseudo-device gif # IPv6 and IPv4 tunneling % kldstat Id Refs Address Size Name 1 5 0xc0100000 3032c8 kernel 3 3 0xc6f47000 e000 miibus.ko 4 1 0xc6f5b000 9000 if_xl.ko 5 1 0xc6f64000 18000 ipl.ko 6 1 0xc7090000 6000 if_rl.ko % kldload if_gif kldload: can't load if_gif: File exists Feb 27 23:14:46 ciach /kernel: can't re-use a leaf (gifttl)! Feb 27 23:14:46 ciach /kernel: module_register: module if_gif already exists! Feb 27 23:14:46 ciach /kernel: linker_file_sysinit "if_gif.ko" failed to register! 17 % kldstat Id Refs Address Size Name 1 6 0xc0100000 3032c8 kernel 3 3 0xc6f47000 e000 miibus.ko 4 1 0xc6f5b000 9000 if_xl.ko 5 1 0xc6f64000 18000 ipl.ko 6 1 0xc7090000 6000 if_rl.ko 7 1 0xc72b5000 5000 if_gif.ko >Fix: Unknown. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:38:37 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BFC1637B401; Thu, 27 Feb 2003 14:38:36 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C60343F75; Thu, 27 Feb 2003 14:38:36 -0800 (PST) (envelope-from gad@FreeBSD.org) Received: from freefall.freebsd.org (gad@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RMcaNS097479; Thu, 27 Feb 2003 14:38:36 -0800 (PST) (envelope-from gad@freefall.freebsd.org) Received: (from gad@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RMcadk097475; Thu, 27 Feb 2003 14:38:36 -0800 (PST) Date: Thu, 27 Feb 2003 14:38:36 -0800 (PST) From: Garance A Drosehn Message-Id: <200302272238.h1RMcadk097475@freefall.freebsd.org> To: gad@FreeBSD.org, freebsd-bugs@FreeBSD.org, gad@FreeBSD.org Subject: Re: bin/46888: Add script run hook to newsyslog(8) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: Add script run hook to newsyslog(8) Responsible-Changed-From-To: freebsd-bugs->gad Responsible-Changed-By: gad Responsible-Changed-When: Thu Feb 27 14:33:40 PST 2003 Responsible-Changed-Why: I am currently doing a bunch of work on newsyslog, so I will also look at your update. From your description it sounds very useful. OpenBSD has a somewhat similar ability in their version of newsyslog, so what I will probably do is some combination of your update and theirs. Note that it may take me a few weeks before I get to this. http://www.freebsd.org/cgi/query-pr.cgi?pr=46888 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:46:11 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 317AA37B406 for ; Thu, 27 Feb 2003 14:46:07 -0800 (PST) Received: from user30.net072.fl.sprint-hsd.net (user30.net072.fl.sprint-hsd.net [209.26.6.30]) by mx1.FreeBSD.org (Postfix) with SMTP id E018743FA3 for ; Thu, 27 Feb 2003 14:46:04 -0800 (PST) (envelope-from jmjjrvle@usa.com) From: American Business Center To: Freebsd-bugs Subject: Английский Разговорный с преподавателями из США-мышление произношение стиль речи ZHk8TjERR2 MIME-Version: 1.0 Content-type: text/html; charset=Windows-1251 Content-Transfer-Encoding: 8bit Message-Id: <20030227224604.E018743FA3@mx1.FreeBSD.org> Date: Thu, 27 Feb 2003 14:46:04 -0800 (PST) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org AMERICAN LANGUAGE CENTER
Tel. 238-33-86 / 778-98-94 / Москва Россия
AMERICAN
LANGUAGE
CENTER
Центр разговорного английского
MEANS/CПОСОБЫ:     
-Изучение использования идиом.

-Обучение разговорной грамматике.

-Совершенствование употребления предлогов.

-Практика устойчивых выражений и фразеологических оборотов.

-Совершенствование стиля речиe.

-Деловая лексика.
ENDS/РЕЗУЛЬТАТЫ:     
-Американское произношение.

-Отсутствие языкового барьера.

-Мышление на языке.

-Легкость в общении.
УНИКАЛЬНАЯ СИСТЕМА АССОЦАТИВНО ОБРАЗНОГО МЫШЛЕНИЯ!
ВСЕ СТАДИИ ОБУЧЕНИЯ ОТ НУЛЯ ДО ВЫСШЕГО!
С ПРЕПОДАВАТЕЛЯМИ ИЗ США!


НАЧИНАЕТСЯ СЕЗОН СКИДОК.
СПЕШИТЕ ИЗМЕНИТЬ СВОЕ БУДУЩЕЕ!
Learn how to speak & understand slang.
НАУЧИТЕСЬ, КАК ГОВОРИТЬ И ПОНИМАТЬ СЛЕНГ.
American business slang & jargon
at school/ at the party/ at the movies/ at the mall/ the new car
at the gym/the house guest/ at work/at the market/ at the restaurant/ at the nightclub/at the record store/ sport terms used in business
slang used in tv comedies/ tv dramas / tv news / tv sports news/ general office / computer/ meeting/ negotiation slangs/ business travel/ marketing/ advertising/office party jargons
finance slang& jargon/ sport terms used in business.
Best of the idioms.
In a word , all сonversational english is at your fingertips.
ОДНИМ СЛОВОМ, ВЕСЬ РАЗГОВОРНЫЙ АНГЛИЙСКИЙ В ВАШЕМ РАСПОРЯЖЕНИИИ

Современный язык 1990-2002 годов для вашей семьи и компании.
Новые супер-учебники 3 4 5 6 уровней в плюс Музыкальные Хиты США с текстами и переводами бесплатно! Смотрите ниже
НАИБОЛЕЕ ПОЛНАЯ И ПРОСТАЯ МЕТОДИКА АНГЛИЙСКОГО РАЗГОВОРНОГО ЯЗЫКА
Perfect your grammar, prepositons, general and business vocabulary, conversation.
УСОВЕРШЕНСТВУЙТЕ ВАШУ ГРАММАТИКУ, ПРЕДЛОГИ, ОБШЕУПОТРЕБИМУЮ И ДЕЛОВУЮ ЛЕКСИКУ, CТИЛЬ РЕЧИ.





OUR OPERATORS ARE STANDING BY. CALL NOW!
ТЕL. 238-33-86/778-98-94 Москва Россия

Freebsd-bugs FydQfEo8EjtO code 6627614

To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 14:50: 6 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33EF237B401 for ; Thu, 27 Feb 2003 14:50:05 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE27943FBF for ; Thu, 27 Feb 2003 14:50:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RMo4NS099612 for ; Thu, 27 Feb 2003 14:50:04 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RMo4Su099611; Thu, 27 Feb 2003 14:50:04 -0800 (PST) Date: Thu, 27 Feb 2003 14:50:04 -0800 (PST) Message-Id: <200302272250.h1RMo4Su099611@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Alex Popa Subject: Re: kern/48717: ipfw2 probability is wrong Reply-To: Alex Popa Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/48717; it has been noted by GNATS. From: Alex Popa To: Maxim Konovalov Cc: bug-followup@freebsd.org Subject: Re: kern/48717: ipfw2 probability is wrong Date: Fri, 28 Feb 2003 00:49:41 +0200 This solves the issue I am seeing. Thank you. Alex On Thu, Feb 27, 2003 at 04:53:05PM +0300, Maxim Konovalov wrote: > > Please try a patch below instead. > > Index: ipfw/ipfw2.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v > retrieving revision 1.4.2.10 > diff -u -r1.4.2.10 ipfw2.c > --- ipfw/ipfw2.c 14 Jan 2003 19:15:59 -0000 1.4.2.10 > +++ ipfw/ipfw2.c 27 Feb 2003 13:47:57 -0000 > @@ -865,7 +865,7 @@ > ipfw_insn_u32 *p = (ipfw_insn_u32 *)cmd; > double d = 1.0 * p->d[0]; > > - d = 1 - (d / 0x7fffffff); > + d = d / 0x7fffffff; > printf("prob %f ", d); > } > break; > @@ -2521,8 +2521,7 @@ > if (d != 1) { /* 1 means always match */ > action->opcode = O_PROB; > action->len = 2; > - *((int32_t *)(action+1)) = > - (int32_t)((1 - d) * 0x7fffffff); > + *((int32_t *)(action+1)) = (int32_t)(d * 0x7fffffff); > action += action->len; > } > av += 2; ac -= 2; > > %%% > > -- > Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org ------------+------------------------------------------------------- Alex Popa, | "Computer science is no more about computers than razor@ldc.ro| astronomy is about telescopes" -- E. W. Dijkstra ------------+------------------------------------------------------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 15:31:50 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59FF837B401; Thu, 27 Feb 2003 15:31:48 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F19B43F75; Thu, 27 Feb 2003 15:31:48 -0800 (PST) (envelope-from dougb@FreeBSD.org) Received: from freefall.freebsd.org (dougb@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RNVlNS014314; Thu, 27 Feb 2003 15:31:47 -0800 (PST) (envelope-from dougb@freefall.freebsd.org) Received: (from dougb@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RNVlh0014310; Thu, 27 Feb 2003 15:31:47 -0800 (PST) Date: Thu, 27 Feb 2003 15:31:47 -0800 (PST) From: Doug Barton Message-Id: <200302272331.h1RNVlh0014310@freefall.freebsd.org> To: erik@smluc.org, dougb@FreeBSD.org, freebsd-bugs@FreeBSD.org, dougb@FreeBSD.org Subject: Re: kern/48727: add usb entry for logitech wingman extreme 3d joystick Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: add usb entry for logitech wingman extreme 3d joystick State-Changed-From-To: open->feedback State-Changed-By: dougb State-Changed-When: Thu Feb 27 15:28:31 PST 2003 State-Changed-Why: I think that you did not carefully read /sys/dev/usb/usbdevs. Please do so, and let me know if it's ok to close this pr. FYI, I have one of thses sticks, and when I plug it in I see the following in the logs: kernel: ugen0: Logitech Inc. WingMan Extreme Digital 3D, rev 1.00/1.05, addr 3 Do you not see something similar? Responsible-Changed-From-To: freebsd-bugs->dougb Responsible-Changed-By: dougb Responsible-Changed-When: Thu Feb 27 15:28:31 PST 2003 Responsible-Changed-Why: I'll handle the feedback. http://www.freebsd.org/cgi/query-pr.cgi?pr=48727 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 20:10:13 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E850437B401 for ; Thu, 27 Feb 2003 20:10:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96C2143F75 for ; Thu, 27 Feb 2003 20:10:11 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S4ABNS090666 for ; Thu, 27 Feb 2003 20:10:11 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S4ABfa090665; Thu, 27 Feb 2003 20:10:11 -0800 (PST) Date: Thu, 27 Feb 2003 20:10:11 -0800 (PST) Message-Id: <200302280410.h1S4ABfa090665@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Alan Batie Subject: Re: bin/47840: libm.so.2 broken on "stable" branch Reply-To: Alan Batie Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/47840; it has been noted by GNATS. From: Alan Batie To: Peter Pentchev Cc: bug-followup@FreeBSD.org Subject: Re: bin/47840: libm.so.2 broken on "stable" branch Date: Thu, 27 Feb 2003 20:04:40 -0800 --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 03, 2003 at 09:35:10PM +0200, Peter Pentchev wrote: > Can you try it, and let us know if that fixes the problem? :) I did a "make world", and the problem recurred, then I did a "make COMPAT3X=3Dyes world" and the problem went away, so yes, that fixes the problem. Thanks! --=20 Alan Batie ______ alan.batie.org Me alan at batie.org \ / www.qrd.org The Triangle PGPFP DE 3C 29 17 C0 49 7A \ / www.pgpi.com The Weird Numbers 27 40 A5 3C 37 4A DA 52 B9 \/ spamassassin.taint.org NO SPAM! --ew6BAiZeqk4r7MaW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iQCVAwUBPl7f2Iv4wNua7QglAQEcVQQAoPK8CW+BxcmESaLR7UGWRt7hniXGYi8I QTvTc3GTQYZi56/gRVx0jBa5j7WzdUaUABP+7AWqNYWYJgyNVZ4XZ1R7Oskzpk+P oSfT56UfTeL8sFak0+nXv9MSBey1yTK+i+Ep220eBu7lX+c1j906B3f3m1sCEx85 9CEUQ1VMCTE= =Yl8x -----END PGP SIGNATURE----- --ew6BAiZeqk4r7MaW-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 20:30:11 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 84FD137B401 for ; Thu, 27 Feb 2003 20:30:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FE3943FB1 for ; Thu, 27 Feb 2003 20:30:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S4U9NS095440 for ; Thu, 27 Feb 2003 20:30:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S4U9OK095439; Thu, 27 Feb 2003 20:30:09 -0800 (PST) Date: Thu, 27 Feb 2003 20:30:09 -0800 (PST) Message-Id: <200302280430.h1S4U9OK095439@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Roy Hooper" Subject: Re: kern/47105: large filesystems may cause infinite panic loop Reply-To: "Roy Hooper" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/47105; it has been noted by GNATS. From: "Roy Hooper" To: , Cc: Subject: Re: kern/47105: large filesystems may cause infinite panic loop Date: Thu, 27 Feb 2003 23:25:05 -0500 This problem appears to be resolved in -STABLE. Snapshots no longer hang and background fsck finishes without a panic. Thanks Kirk. -- Roy Hooper (rhooper@toybox.ca) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 20:30:14 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E44737B401 for ; Thu, 27 Feb 2003 20:30:12 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 396EE43FBD for ; Thu, 27 Feb 2003 20:30:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S4UCNS095473 for ; Thu, 27 Feb 2003 20:30:12 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S4UC4P095471; Thu, 27 Feb 2003 20:30:12 -0800 (PST) Date: Thu, 27 Feb 2003 20:30:12 -0800 (PST) Message-Id: <200302280430.h1S4UC4P095471@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Roy Hooper" Subject: Re: kern/47105: large filesystems may cause infinite panic loop Reply-To: "Roy Hooper" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/47105; it has been noted by GNATS. From: "Roy Hooper" To: "Roy Hooper" , , Cc: Subject: Re: kern/47105: large filesystems may cause infinite panic loop Date: Thu, 27 Feb 2003 23:27:19 -0500 > > This problem appears to be resolved in -STABLE. Snapshots no longer hang > and background fsck finishes without a panic. I mean -CURRENT. -- Roy Hooper (rhooper@toybox.ca) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 21: 5:44 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B4D837B401; Thu, 27 Feb 2003 21:05:43 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2EFBF43FAF; Thu, 27 Feb 2003 21:05:43 -0800 (PST) (envelope-from maxim@FreeBSD.org) Received: from freefall.freebsd.org (maxim@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S55hNS007923; Thu, 27 Feb 2003 21:05:43 -0800 (PST) (envelope-from maxim@freefall.freebsd.org) Received: (from maxim@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S55gV3007919; Thu, 27 Feb 2003 21:05:42 -0800 (PST) Date: Thu, 27 Feb 2003 21:05:42 -0800 (PST) From: Maxim Konovalov Message-Id: <200302280505.h1S55gV3007919@freefall.freebsd.org> To: rhooper@slinky.toybox.ca, maxim@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/47105: large filesystems may cause infinite panic loop Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: large filesystems may cause infinite panic loop State-Changed-From-To: open->closed State-Changed-By: maxim State-Changed-When: Thu Feb 27 21:05:14 PST 2003 State-Changed-Why: Fixed in -CURRENT. http://www.freebsd.org/cgi/query-pr.cgi?pr=47105 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 23: 0:34 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 80A9637B401 for ; Thu, 27 Feb 2003 23:00:32 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8868343FCB for ; Thu, 27 Feb 2003 23:00:26 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S70QNS033501 for ; Thu, 27 Feb 2003 23:00:26 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S70QnB033500; Thu, 27 Feb 2003 23:00:26 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F38E37B401 for ; Thu, 27 Feb 2003 22:53:55 -0800 (PST) Received: from cheesy.cypherpunks.to (adsl-208-201-229-161.sonic.net [208.201.229.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5ECFD43FAF for ; Thu, 27 Feb 2003 22:53:54 -0800 (PST) (envelope-from shamrock@cheesy.cypherpunks.to) Received: from cheesy.cypherpunks.to (localhost [127.0.0.1]) by cheesy.cypherpunks.to (8.12.7/8.12.7) with ESMTP id h1S6rln7000696; Thu, 27 Feb 2003 22:53:47 -0800 (PST) (envelope-from shamrock@cheesy.cypherpunks.to) Received: (from shamrock@localhost) by cheesy.cypherpunks.to (8.12.7/8.12.7/Submit) id h1S6rl1o000695; Thu, 27 Feb 2003 22:53:47 -0800 (PST) Message-Id: <200302280653.h1S6rl1o000695@cheesy.cypherpunks.to> Date: Thu, 27 Feb 2003 22:53:47 -0800 (PST) From: Lucky Green Reply-To: Lucky Green To: FreeBSD-gnats-submit@FreeBSD.org Cc: shamrock@cypherpunks.to X-Send-Pr-Version: 3.113 Subject: bin/48765: sysinstall crashes when GBDE device is attached to kernel Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48765 >Category: bin >Synopsis: sysinstall crashes when GBDE device is attached to kernel >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 27 23:00:25 PST 2003 >Closed-Date: >Last-Modified: >Originator: Lucky Green >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD cheesy.cypherpunks.to 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Thu Feb 27 19:30:51 PST 2003 shamrock@cheesy.cypherpunks.to:/usr/obj/usr/src/sys/2003022701 i386 Multiple i386 machines >Description: /stand/sysinstall will reliably crash with error "BARF 337"during the intitial probing of devices when a GBDE device is attached to the kernel. The GBDE device does not need to be mounted, just attached. This bug has been observed on all machines on which I tested using sysinstall with GBDE. >How-To-Repeat: Create and attach a GBDE device per man gbde. Execute /stand/sysinstall as root. sysinstall will crash. If you cannot duplicte this bug the very first time you attempt to do so, please contact me for details. >Fix: Fix the bug in sysinstall? :) >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Thu Feb 27 23:25: 8 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 474D137B401; Thu, 27 Feb 2003 23:25:07 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE9BD43FB1; Thu, 27 Feb 2003 23:25:06 -0800 (PST) (envelope-from roam@FreeBSD.org) Received: from freefall.freebsd.org (roam@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S7P6NS043277; Thu, 27 Feb 2003 23:25:06 -0800 (PST) (envelope-from roam@freefall.freebsd.org) Received: (from roam@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S7P64d043273; Thu, 27 Feb 2003 23:25:06 -0800 (PST) Date: Thu, 27 Feb 2003 23:25:06 -0800 (PST) From: Peter Pentchev Message-Id: <200302280725.h1S7P64d043273@freefall.freebsd.org> To: alan@agora.rdrop.com, roam@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: bin/47840: libm.so.2 broken on "stable" branch Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: libm.so.2 broken on "stable" branch State-Changed-From-To: feedback->closed State-Changed-By: roam State-Changed-When: Thu Feb 27 23:24:18 PST 2003 State-Changed-Why: Submitter confirms that COMPAT_3X=yes solves the problem. Still, thanks for trying to improve FreeBSD by reporting this problem! http://www.freebsd.org/cgi/query-pr.cgi?pr=47840 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 0:19:39 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47D2E37B401; Fri, 28 Feb 2003 00:19:38 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF67843FBF; Fri, 28 Feb 2003 00:19:37 -0800 (PST) (envelope-from maxim@FreeBSD.org) Received: from freefall.freebsd.org (maxim@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1S8JbNS057177; Fri, 28 Feb 2003 00:19:37 -0800 (PST) (envelope-from maxim@freefall.freebsd.org) Received: (from maxim@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1S8JZpe057172; Fri, 28 Feb 2003 00:19:35 -0800 (PST) Date: Fri, 28 Feb 2003 00:19:35 -0800 (PST) From: Maxim Konovalov Message-Id: <200302280819.h1S8JZpe057172@freefall.freebsd.org> To: razor@ldc.ro, maxim@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/48717: ipfw2 probability is wrong Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: ipfw2 probability is wrong State-Changed-From-To: open->patched State-Changed-By: maxim State-Changed-When: Fri Feb 28 00:18:39 PST 2003 State-Changed-Why: Fixed in rev. 1.17 src/sbin/ipfw/ipfw2.c in -CURRENT several months ago. http://www.freebsd.org/cgi/query-pr.cgi?pr=48717 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 4: 1:38 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 247A837B401; Fri, 28 Feb 2003 04:01:36 -0800 (PST) Received: from mailout3-eri1.midsouth.rr.com (mailout3-eri1.midsouth.rr.com [24.165.200.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD04B43F75; Fri, 28 Feb 2003 04:01:34 -0800 (PST) (envelope-from erik@phoenix.smluc.org) Received: from xarx.localdomain (root@cpe-066-061-038-083.midsouth.rr.com [66.61.38.83]) by mailout3-eri1.midsouth.rr.com (8.11.4/8.11.4) with ESMTP id h1SC1bS06971; Fri, 28 Feb 2003 06:01:37 -0600 (CST) Received: (from erik@localhost) by xarx.localdomain (8.11.6/8.11.6) id h1SC1XI07161; Fri, 28 Feb 2003 06:01:33 -0600 Date: Fri, 28 Feb 2003 06:01:33 -0600 From: Erik Greenwald To: Doug Barton Cc: freebsd-bugs@FreeBSD.org Subject: Re: kern/48727: add usb entry for logitech wingman extreme 3d joystick Message-ID: <20030228060133.A6903@xarx.midsouth.rr.com> References: <200302272331.h1RNVlh0014310@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200302272331.h1RNVlh0014310@freefall.freebsd.org>; from dougb@FreeBSD.org on Thu, Feb 27, 2003 at 03:31:47PM -0800 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Thu, Feb 27, 2003 at 03:31:47PM -0800, Doug Barton wrote: > > I think that you did not carefully read /sys/dev/usb/usbdevs. > Please do so, and let me know if it's ok to close this pr. > > FYI, I have one of thses sticks, and when I plug it in I see > the following in the logs: > > kernel: ugen0: Logitech Inc. WingMan Extreme Digital 3D, rev 1.00/1.05, addr 3 > > Do you not see something similar? > > No, I don't... this is from my /var/log/messages with the kernel as of ~1400cst feb 26, using 'kldload uhid' Feb 26 16:58:25 fenris kernel: uhid0: Logitech product 0xc212, rev 1.00/1.05,addr 2, iclass 3/0 usbdevs also does not list this certain joystick erik@fenris /usr/src/sys/dev/usb$ grep -i wingman usbdevs product LOGITECH WMMOUSE 0xc004 WingMan Gaming Mouse product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme product LOGITECH WMJOY 0xc281 WingMan Force joystick erik@fenris /usr/src/sys/dev/usb$ With a fresh kernel... FreeBSD fenris 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Fri Feb 28 05:30:47 CST 2003 root@fenris:/usr/src/sys/i386/compile/FENRIS i386 I get ugen0: Logitech product 0xc212, rev 1.00/1.05, addr 2 I'm not sure where the discrepency is, but I'm not seeing the appropriate device name... here's an updated patch that makes the change in the right place, tested with this mornings kernel --- src/sys/dev/usb/usbdevs.orig Fri Feb 28 05:47:29 2003 +++ src/sys/dev/usb/usbdevs Fri Feb 28 05:50:13 2003 @@ -786,6 +786,7 @@ product LOGITECH UN58A 0xc030 iFeel Mouse product LOGITECH BB13 0xc401 USB-PS/2 Trackball product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme +product LOGITECH WMED3D 0xc212 WingMan Extreme Digital 3D product LOGITECH WMJOY 0xc281 WingMan Force joystick product LOGITECH RK53 0xc501 Cordless mouse product LOGITECH RB6 0xc503 Cordless keyboard (perhaps the issue is with the usb controller? I'm using a VIA 83C572... maybe it has a bug where it can't poll the string posted by the device? I'm grasping at straws, I haven't dealt with usb before, this is my first usb device... :) -- -Erik [http://math.smsu.edu/~erik] The opinions expressed by me are not necessarily opinions. In all probability, they are random rambling, and to be ignored. Failure to ignore may result in severe boredom or confusion. Shake well before opening. Keep Refrigerated. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 4:10:15 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA78A37B401 for ; Fri, 28 Feb 2003 04:10:13 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA80843FA3 for ; Fri, 28 Feb 2003 04:10:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SCACNS020204 for ; Fri, 28 Feb 2003 04:10:12 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SCACEd020203; Fri, 28 Feb 2003 04:10:12 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CA1837B401 for ; Fri, 28 Feb 2003 04:03:25 -0800 (PST) Received: from mailout07.sul.t-online.com (mailout07.sul.t-online.com [194.25.134.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C1AE43F3F for ; Fri, 28 Feb 2003 04:03:24 -0800 (PST) (envelope-from gerd.moellmann@t-online.de) Received: from fwd05.sul.t-online.de by mailout07.sul.t-online.com with smtp id 18ojEZ-00069C-03; Fri, 28 Feb 2003 13:03:23 +0100 Received: from gerd.free-bsd.org (520015515780-0001@[217.85.168.155]) by fwd05.sul.t-online.com with esmtp id 18ojEN-1UN3aqC; Fri, 28 Feb 2003 13:03:11 +0100 Received: from gerd.free-bsd.org (localhost [127.0.0.1]) by gerd.free-bsd.org (8.12.7/8.12.7) with ESMTP id h1SC39Kq000410 for ; Fri, 28 Feb 2003 13:03:10 +0100 (CET) (envelope-from gerd@gerd.free-bsd.org) Received: (from gerd@localhost) by gerd.free-bsd.org (8.12.7/8.12.7/Submit) id h1SC35sN000409; Fri, 28 Feb 2003 13:03:05 +0100 (CET) Message-Id: <200302281203.h1SC35sN000409@gerd.free-bsd.org> Date: Fri, 28 Feb 2003 13:03:05 +0100 (CET) From: gerd.moellmann@t-online.de (Gerd Moellmann) Reply-To: Gerd Moellmann To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: conf/48775: iso8859-15 termcap entries needed Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48775 >Category: conf >Synopsis: iso8859-15 termcap entries needed >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 28 04:10:12 PST 2003 >Closed-Date: >Last-Modified: >Originator: Gerd Moellmann >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: None >Environment: System: FreeBSD gerd.free-bsd.org 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #0: Wed Feb 26 00:02:13 CET 2003 root@gerd.free-bsd.org:/usr/obj/usr/src/sys/KERNG i386 >Description: ISO8859-15 doesn't contain the `graphics charset pairs' that ISO8859-1 has for termcap capability `ac', which is used by dialog(1), for instance. Choosing one of the existing termcap entries on the console, say TERM=cons25l1 (iso8859-1), leads to garbled-looking termcap applications. >How-To-Repeat: Set LANG to de_DE.ISO8859-15, choose a iso8859-15 font with vidfont(1). Try to find a TERM setting with which vidfont(1) display looks reasonable. >Fix: Include entries in /etc/termcap like cons25l9|cons25l9|cons25 latin9:\ :ac@:tc=cons25l1: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 4:42:14 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06CD737B401; Fri, 28 Feb 2003 04:42:14 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9DCC343F3F; Fri, 28 Feb 2003 04:42:13 -0800 (PST) (envelope-from harti@FreeBSD.org) Received: from freefall.freebsd.org (harti@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SCgDNS028075; Fri, 28 Feb 2003 04:42:13 -0800 (PST) (envelope-from harti@freefall.freebsd.org) Received: (from harti@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SCgDlt028071; Fri, 28 Feb 2003 04:42:13 -0800 (PST) Date: Fri, 28 Feb 2003 04:42:13 -0800 (PST) From: Hartmut Brandt Message-Id: <200302281242.h1SCgDlt028071@freefall.freebsd.org> To: brandt@fokus.fraunhofer.de, harti@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/47408: td_wmesg not cleared leads to panic when doing 'ps ax' Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: td_wmesg not cleared leads to panic when doing 'ps ax' State-Changed-From-To: open->closed State-Changed-By: harti State-Changed-When: Fri Feb 28 04:41:38 PST 2003 State-Changed-Why: Patch applied. http://www.freebsd.org/cgi/query-pr.cgi?pr=47408 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 4:50:10 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13D9A37B401 for ; Fri, 28 Feb 2003 04:50:08 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 991A443F93 for ; Fri, 28 Feb 2003 04:50:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SCo4NS028215 for ; Fri, 28 Feb 2003 04:50:04 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SCo4CH028214; Fri, 28 Feb 2003 04:50:04 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 740FA37B401 for ; Fri, 28 Feb 2003 04:49:47 -0800 (PST) Received: from mail.rotfl.com.au (eth1779.sa.adsl.internode.on.net [150.101.235.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id 334A043FCB for ; Fri, 28 Feb 2003 04:49:46 -0800 (PST) (envelope-from philk@rotfl.com.au) Message-Id: <20030228124944.E11C83F3@mail.rotfl.com.au> Date: Fri, 28 Feb 2003 23:19:44 +1030 (CST) From: Phil Kernick Reply-To: Phil Kernick To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48777: vidcontrol modes not restored on vt switch from X Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48777 >Category: kern >Synopsis: vidcontrol modes not restored on vt switch from X >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 28 04:50:04 PST 2003 >Closed-Date: >Last-Modified: >Originator: Phil Kernick >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: >Environment: System: FreeBSD catbert.rotfl.com.au 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #0: Fri Feb 28 18:00:36 CST 2003 root@catbert.rotfl.com.au:/pub/FreeBSD/obj/pub/FreeBSD/branches/4.0-stable/src/sys/CATBERT i386 >Description: When switching virtual console from X to a text console, the vidcontol modes are not restored. >How-To-Repeat: Demonstration of the problem: # vidcontrol VGA_90x30 < /dev/ttyv0 Alt-F9 to switch to XFree86 Alt-F1 to switch back The screen is now in 80x25 mode, but it thinks it's in 90x30, meaning that each line is offset by 10 characters. However, after the screen saver has activated and then been deactivated, the vidcontrol settings are restored. Looking at the XFree86 source, when switching away it does this: ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); Looking in src/sys/dev/syscons/syscons.c for this ioctl, we have: return sc_switch_scr(sc, i); sc_switch_scr doesn't ever seem to call scrn_update which restores the screen. Can someone who is a syscons expert have a look at this? >Fix: Not known. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 7:40:14 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B5DB037B401 for ; Fri, 28 Feb 2003 07:40:09 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BFE543FBD for ; Fri, 28 Feb 2003 07:40:07 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SFe7NS038600 for ; Fri, 28 Feb 2003 07:40:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SFe7n9038599; Fri, 28 Feb 2003 07:40:07 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6594037B401 for ; Fri, 28 Feb 2003 07:32:53 -0800 (PST) Received: from chagford.netcraft.com (chagford.netcraft.com [195.92.95.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BE6843FB1 for ; Fri, 28 Feb 2003 07:32:52 -0800 (PST) (envelope-from jez@chagford.netcraft.com) Received: from chagford.netcraft.com (localhost [127.0.0.1]) by chagford.netcraft.com (8.12.6/8.12.6) with ESMTP id h1SFWlkc005573 for ; Fri, 28 Feb 2003 15:32:47 GMT (envelope-from jez@chagford.netcraft.com) Received: (from jez@localhost) by chagford.netcraft.com (8.12.6/8.12.6/Submit) id h1SFWj8A005539; Fri, 28 Feb 2003 15:32:46 GMT Message-Id: <200302281532.h1SFWj8A005539@chagford.netcraft.com> Date: Fri, 28 Feb 2003 15:32:46 GMT From: Jeremy Prior Reply-To: Jeremy Prior To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48784: No way to disable directory listings in ftpd Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48784 >Category: bin >Synopsis: No way to disable directory listings in ftpd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 28 07:40:07 PST 2003 >Closed-Date: >Last-Modified: >Originator: Jeremy Prior >Release: FreeBSD 4.7-STABLE i386 >Organization: Netcraft Ltd >Environment: System: FreeBSD chagford.netcraft.com 4.7-STABLE FreeBSD 4.7-STABLE #1: Fri Jan 17 21:34:17 GMT 2003 root@chagford.netcraft.com:/usr/obj/usr/src/sys/CHAGFORD i386 >Description: We need to run a customer-facing ftpd that doesn't allow directory listings. The base system's one can be made to prevent this if the right bits are lopped-out. :-) >How-To-Repeat: Connect to ftpd and type `dir' >Fix: Patch follows: --- ftpd.diff begins here --- Index: Makefile =================================================================== RCS file: /usr/cvs/src/libexec/ftpd/Makefile,v retrieving revision 1.33.2.6 diff -u -r1.33.2.6 Makefile --- Makefile 11 Feb 2003 14:28:28 -0000 1.33.2.6 +++ Makefile 28 Feb 2003 13:51:32 -0000 @@ -12,10 +12,14 @@ LDADD= -lskey -lmd -lcrypt -lutil DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} ${LIBUTIL} +.if defined(NO_LISTINGS) +CFLAGS+=-DNO_LISTINGS +.else LSDIR= ../../bin/ls .PATH: ${.CURDIR}/${LSDIR} SRCS+= ls.c cmp.c print.c util.c CFLAGS+=-Dmain=ls_main -I${.CURDIR}/${LSDIR} +.endif DPADD+= ${LIBM} LDADD+= -lm Index: ftpcmd.y =================================================================== RCS file: /usr/cvs/src/libexec/ftpd/ftpcmd.y,v retrieving revision 1.16.2.19 diff -u -r1.16.2.19 ftpcmd.y --- ftpcmd.y 11 Feb 2003 14:28:28 -0000 1.16.2.19 +++ ftpcmd.y 28 Feb 2003 14:01:34 -0000 @@ -475,25 +475,33 @@ } | NLST check_login CRLF { +#ifndef NO_LISTINGS if ($2) send_file_list("."); +#endif } | NLST check_login SP pathstring CRLF { +#ifndef NO_LISTINGS if ($2) send_file_list($4); free($4); +#endif } | LIST check_login CRLF { +#ifndef NO_LISTINGS if ($2) retrieve(_PATH_LS " -lgA", ""); +#endif } | LIST check_login SP pathstring CRLF { +#ifndef NO_LISTINGS if ($2) retrieve(_PATH_LS " -lgA %s", $4); free($4); +#endif } | STAT check_login SP pathname CRLF { @@ -1127,8 +1135,10 @@ { "DELE", DELE, STR1, 1, " file-name" }, { "CWD", CWD, OSTR, 1, "[ directory-name ]" }, { "XCWD", CWD, OSTR, 1, "[ directory-name ]" }, +#ifndef NO_LISTINGS { "LIST", LIST, OSTR, 1, "[ path-name ]" }, { "NLST", NLST, OSTR, 1, "[ path-name ]" }, +#endif { "SITE", SITE, SITECMD, 1, "site-cmd [ arguments ]" }, { "SYST", SYST, ARGS, 1, "(get type of operating system)" }, { "STAT", STAT, OSTR, 1, "[ path-name ]" }, Index: ftpd.c =================================================================== RCS file: /usr/cvs/src/libexec/ftpd/ftpd.c,v retrieving revision 1.62.2.48 diff -u -r1.62.2.48 ftpd.c --- ftpd.c 14 Feb 2003 12:42:42 -0000 1.62.2.48 +++ ftpd.c 28 Feb 2003 13:51:34 -0000 @@ -2970,6 +2970,7 @@ send_file_list(whichf) char *whichf; { +#ifndef NO_LISTINGS struct stat st; DIR *dirp = NULL; struct dirent *dir; @@ -3100,6 +3101,7 @@ freeglob = 0; globfree(&gl); } +#endif } void Index: popen.c =================================================================== RCS file: /usr/cvs/src/libexec/ftpd/popen.c,v retrieving revision 1.18.2.3 diff -u -r1.18.2.3 popen.c --- popen.c 9 Aug 2001 00:53:18 -0000 1.18.2.3 +++ popen.c 11 Aug 2001 08:09:21 -0000 @@ -143,6 +143,7 @@ } (void)close(pdes[1]); } +#ifndef NO_LISTINGS if (strcmp(gargv[0], _PATH_LS) == 0) { /* Reset getopt for ls_main() */ optreset = optind = optopt = 1; @@ -157,6 +158,7 @@ } exit(ls_main(gargc, gargv)); } +#endif execv(gargv[0], gargv); _exit(1); } --- ftpd.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 8:50:21 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1106A37B405 for ; Fri, 28 Feb 2003 08:50:20 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1E3B43F93 for ; Fri, 28 Feb 2003 08:50:19 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SGoJNS055972 for ; Fri, 28 Feb 2003 08:50:19 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SGoJUn055969; Fri, 28 Feb 2003 08:50:19 -0800 (PST) Date: Fri, 28 Feb 2003 08:50:19 -0800 (PST) Message-Id: <200302281650.h1SGoJUn055969@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jim Barker Subject: Re: kern/48691: kernel panics on ASUS A7N266-VM Motherboard Reply-To: Jim Barker Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/48691; it has been noted by GNATS. From: Jim Barker To: freebsd-gnats-submit@freebsd.org Cc: jimbark@attglobal.net Subject: Re: kern/48691: kernel panics on ASUS A7N266-VM Motherboard Date: Fri, 28 Feb 2003 11:49:46 -0500 (EST) Two things...... 1. Please change the originator of this bug report to jimbark@attglobal.net, as I had to submit this pr from another machine. 2. I hadn't seen any updates on this pr, so I thought I would cvsup to the newest RELENG_4 tag and got 4.8 prelease. My machine has now been running for approximately a day and a half or 35 hours without a panic. I also can run UT 2003 after the 35 hours with no repercussions. I still have the debugging kernel as well as the vmcore image from when it was panicing if there is still interest in debugging the 4.7 release. Please let me know how I can help to resolve the matter if necessary. Thanks, Jim Barker To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 9:42:21 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 402BA37B401 for ; Fri, 28 Feb 2003 09:42:20 -0800 (PST) Received: from mail.libertysurf.net (mail.libertysurf.net [213.36.80.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E7B343F75 for ; Fri, 28 Feb 2003 09:42:18 -0800 (PST) (envelope-from raoul.megelas@libertysurf.fr) Received: from libertysurf.fr (212.232.55.116) by mail.libertysurf.net (6.5.026) id 3DE3AE5700DF1C68 for freebsd-bugs@freebsd.org; Fri, 28 Feb 2003 18:42:16 +0100 Received: from raoul by port.private.music with local (Exim 4.12) id 18ooWl-0000Cx-00 for freebsd-bugs@freebsd.org; Fri, 28 Feb 2003 18:42:31 +0100 Date: Fri, 28 Feb 2003 18:42:31 +0100 From: "raoul.megelas" To: freebsd-bugs@freebsd.org Subject: serial rs-232 pccard. Message-ID: <20030228184231.A776@libertysurf.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello, I encounter a problem with an old rs-232 serial pccard on current (just cvsup'ed). The card works quite well on 5.0-RELEASE, but it it is detected as a wlan card and FreeBSD attempts to run the wi driver. This calls the debugger, and the command (continue) reboot the machine, and that at boot, or after any insertion of the card. I don't know if the machine is very relevant but ... DELL Inspiron 8000 laptop.. The acpi is loaded, and seems to work. An Adaptec apa-1460 pccard works well too, (the IRQ (11) is correctly handled). Here is the message at boot: pccard1: CIS checksum failed. wi0: "Socket Communications Low Power wlan card" at port 0x100-0x107 irq 11 fun1 wi0 init failed. panic block: (sleep mutex" wi0 not locked @ /usr/src-current/src/sys/devwi/if_w3 debugger (panic) stopped at: debugger+0x54: xchgl %ebx,in_debugger.0. Sorry if I have forgotten something. Best regards raoul raoul.megelas@libertysurf.fr To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 11:20:15 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9955B37B405 for ; Fri, 28 Feb 2003 11:20:12 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3C4743F85 for ; Fri, 28 Feb 2003 11:20:11 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SJKBNS096106 for ; Fri, 28 Feb 2003 11:20:11 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SJKBaw096105; Fri, 28 Feb 2003 11:20:11 -0800 (PST) Date: Fri, 28 Feb 2003 11:20:11 -0800 (PST) Message-Id: <200302281920.h1SJKBaw096105@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jim Barker Subject: Re: kern/48691: kernel panics on ASUS A7N266-VM Motherboard Reply-To: Jim Barker Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/48691; it has been noted by GNATS. From: Jim Barker To: freebsd-gnats-submit@freebsd.org Cc: jimbark@attglobal.net Subject: Re: kern/48691: kernel panics on ASUS A7N266-VM Motherboard Date: Fri, 28 Feb 2003 13:43:28 -0500 (EST) Wouldn't you know it.....Murphy strikes again. Almost as soon as I sent the message that my machine had been up for 35 hours, it panic'd on me. Since this is 4.8 pre-release, I am not sure if I am expected to submit a whole new pr or not, but I am including a gdb output in this anyway. So.....back to square one. Script started on Fri Feb 28 13:30:32 2003 You have mail. bsdut# gdb -k kernel.debug.20030226 vmcore.7 GNU gdb 4.18 (FreeBSD) Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in elfstab_build_psymtabs Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf IdlePTD at phsyical address 0x00592000 initial pcb at physical address 0x0037c440 panicstr: page fault panic messages: --- Fatal trap 12: page fault while in kernel mode fault virtual address = 0xffffff1d fault code = supervisor read, page not present instruction pointer = 0x8:0xc02608f0 stack pointer = 0x10:0xe02a3c2c frame pointer = 0x10:0xe02a3c34 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 7804 (sh) interrupt mask = net tty bio cam trap number = 12 panic: page fault syncing disks... 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 giving up on 14 buffers Uptime: 1d10h59m39s dumping to dev #ad/0x20001, offset 1049122 dump ata0: resetting devices .. done ad0: timeout waiting for DRQ - resetting ata0: resetting devices .. ata0-slave: ATA identify retries exceeded done 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 423 422 421 420 419 418 417 416 415 414 413 412 411 410 409 408 407 406 405 404 403 402 401 400 399 398 397 396 395 394 393 392 391 390 389 388 387 386 385 384 383 382 381 380 379 378 377 376 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 355 354 353 352 351 350 349 348 347 346 345 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 2! 64 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 --- #0 dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487 487 if (dumping++) { (kgdb) where #0 dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487 #1 0xc0173003 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:316 #2 0xc0173428 in poweroff_wait (junk=0xc031f5ec, howto=-1070468849) at /usr/src/sys/kern/kern_shutdown.c:595 #3 0xc02d0ed6 in trap_fatal (frame=0xe02a3bec, eva=4294967069) at /usr/src/sys/i386/i386/trap.c:974 #4 0xc02d0ba9 in trap_pfault (frame=0xe02a3bec, usermode=0, eva=4294967069) at /usr/src/sys/i386/i386/trap.c:867 #5 0xc02d0793 in trap (frame={tf_fs = 16, tf_es = 16, tf_ds = 16, tf_edi = -530322144, tf_esi = 0, tf_ebp = -534102988, tf_isp = -534103016, tf_ebx = -530322144, tf_edx = -247, tf_ecx = 5354240, tf_eax = 262137, tf_trapno = 12, tf_err = 0, tf_eip = -1071249168, tf_cs = 8, tf_eflags = 66182, tf_esp = -1061061312, tf_ss = -532622784}) at /usr/src/sys/i386/i386/trap.c:466 #6 0xc02608f0 in vm_page_lookup (object=0xe063ed20, pindex=0) at /usr/src/sys/vm/vm_page.c:514 #7 0xc025fcf2 in vm_object_collapse (object=0xe063ed20) at /usr/src/sys/vm/vm_object.c:1262 #8 0xc025efb0 in vm_object_deallocate (object=0xe064cd20) at /usr/src/sys/vm/vm_object.c:368 #9 0xc025c4a4 in vm_map_entry_delete (map=0xd4a70b00, entry=0xe0526e10) at /usr/src/sys/vm/vm_map.c:2053 ---Type to continue, or q to quit---upq Quit (kgdb) up 6 #6 0xc02608f0 in vm_page_lookup (object=0xe063ed20, pindex=0) at /usr/src/sys/vm/vm_page.c:514 514 for (m = *bucket; m != NULL; m = m->hnext) { (kgdb) list 509 */ 510 511 retry: 512 generation = vm_page_bucket_generation; 513 bucket = &vm_page_buckets[vm_page_hash(object, pindex)]; 514 for (m = *bucket; m != NULL; m = m->hnext) { 515 if ((m->object == object) && (m->pindex == pindex)) { 516 if (vm_page_bucket_generation != generation) 517 goto retry; 518 return (m); (kgdb) p m $1 = 0x0 (kgdb) q To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 13:23:52 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADEE937B401; Fri, 28 Feb 2003 13:23:51 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5040A43FDD; Fri, 28 Feb 2003 13:23:51 -0800 (PST) (envelope-from keramida@FreeBSD.org) Received: from freefall.freebsd.org (keramida@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SLNpNS030218; Fri, 28 Feb 2003 13:23:51 -0800 (PST) (envelope-from keramida@freefall.freebsd.org) Received: (from keramida@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SLNoES030214; Fri, 28 Feb 2003 13:23:50 -0800 (PST) Date: Fri, 28 Feb 2003 13:23:50 -0800 (PST) From: Giorgos Keramidas Message-Id: <200302282123.h1SLNoES030214@freefall.freebsd.org> To: land@dnepr.net, keramida@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/27275: kernel bug ? Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: kernel bug ? State-Changed-From-To: feedback->closed State-Changed-By: keramida State-Changed-When: Fri Feb 28 13:21:30 PST 2003 State-Changed-Why: Feedback timeout, after 6 months. Andrey, if you find the time in the future to test a newer release, you're always welcome to submit a new PR. http://www.freebsd.org/cgi/query-pr.cgi?pr=27275 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 13:28:15 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8222137B401; Fri, 28 Feb 2003 13:28:14 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B7DB43F85; Fri, 28 Feb 2003 13:28:14 -0800 (PST) (envelope-from keramida@FreeBSD.org) Received: from freefall.freebsd.org (keramida@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SLSDNS030338; Fri, 28 Feb 2003 13:28:13 -0800 (PST) (envelope-from keramida@freefall.freebsd.org) Received: (from keramida@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SLSDhe030334; Fri, 28 Feb 2003 13:28:13 -0800 (PST) Date: Fri, 28 Feb 2003 13:28:13 -0800 (PST) From: Giorgos Keramidas Message-Id: <200302282128.h1SLSDhe030334@freefall.freebsd.org> To: land@dnepr.net, keramida@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/27275: kernel bug ? Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: kernel bug ? State-Changed-From-To: closed->feedback State-Changed-By: keramida State-Changed-When: Fri Feb 28 13:26:38 PST 2003 State-Changed-Why: Grrmpf! I hate it when lynx shows me only half of the PR text. This is certainly not ready to be closed, yet. http://www.freebsd.org/cgi/query-pr.cgi?pr=27275 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 13:50:12 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D29037B401; Fri, 28 Feb 2003 13:50:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 29D1543FE3; Fri, 28 Feb 2003 13:50:02 -0800 (PST) (envelope-from keramida@FreeBSD.org) Received: from freefall.freebsd.org (keramida@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SLo2NS034231; Fri, 28 Feb 2003 13:50:02 -0800 (PST) (envelope-from keramida@freefall.freebsd.org) Received: (from keramida@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SLo2ce034227; Fri, 28 Feb 2003 13:50:02 -0800 (PST) Date: Fri, 28 Feb 2003 13:50:02 -0800 (PST) From: Giorgos Keramidas Message-Id: <200302282150.h1SLo2ce034227@freefall.freebsd.org> To: wdf@picusnet.com, keramida@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/38840: when i pass data over my dialup connection, 4.6-RC dies Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: when i pass data over my dialup connection, 4.6-RC dies State-Changed-From-To: open->feedback State-Changed-By: keramida State-Changed-When: Fri Feb 28 13:48:30 PST 2003 State-Changed-Why: Can you try building a kernel with debugging support and try to get a crash dump, or install a newer release (like 4.6-RELEASE or 4.7-RELEASE)? http://www.freebsd.org/cgi/query-pr.cgi?pr=38840 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 13:50:16 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1727237B405 for ; Fri, 28 Feb 2003 13:50:14 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED53443FA3 for ; Fri, 28 Feb 2003 13:50:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SLoCNS034354 for ; Fri, 28 Feb 2003 13:50:12 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SLoCmx034353; Fri, 28 Feb 2003 13:50:12 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3669237B401 for ; Fri, 28 Feb 2003 13:48:10 -0800 (PST) Received: from fafoe.dyndns.org (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B91643FA3 for ; Fri, 28 Feb 2003 13:48:09 -0800 (PST) (envelope-from stefan@fafoe.dyndns.org) Received: from frog.fafoe (frog.fafoe [192.168.2.101]) by fafoe.dyndns.org (Postfix) with ESMTP id C0B354066; Fri, 28 Feb 2003 22:48:07 +0100 (CET) Received: by frog.fafoe (Postfix, from userid 1001) id 3A490848; Fri, 28 Feb 2003 22:48:07 +0100 (CET) Message-Id: <20030228214807.3A490848@frog.fafoe> Date: Fri, 28 Feb 2003 22:48:07 +0100 (CET) From: Stefan Farfeleder Reply-To: Stefan Farfeleder To: FreeBSD-gnats-submit@FreeBSD.org Cc: stefan@fafoe.dyndns.org X-Send-Pr-Version: 3.113 Subject: bin/48793: [patch] small fix for apmd(8) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48793 >Category: bin >Synopsis: [patch] small fix for apmd(8) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 28 13:50:10 PST 2003 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD frog.fafoe 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Fri Feb 28 12:02:34 CET 2003 freebsd@frog.fafoe:/freebsd/frog/obj/freebsd/frog/src/sys/FROG i386 >Description: The BATTTIME and BATTPERCENT tokens of apmdparse.y use the int member 'i' of the yylval union, not 'str'. An integer is assigned to yylval.i in apmdlex.l and non-terminal apm_battery_level has type int too. >How-To-Repeat: buildworld produces these warnings: ===> usr.sbin/apmd cc -O -pipe -mcpu=pentiumpro -I. -I/freebsd/frog/src/usr.sbin/apmd -c /freebsd/frog/src/usr.sbin/apmd/apmd.c gzip -cn /freebsd/frog/src/usr.sbin/apmd/apmd.8 > apmd.8.gz cc -O -pipe -mcpu=pentiumpro -I. -I/freebsd/frog/src/usr.sbin/apmd -c apmdparse.c cc -O -pipe -mcpu=pentiumpro -I. -I/freebsd/frog/src/usr.sbin/apmd -c apmdlex.c /freebsd/frog/src/usr.sbin/apmd/apmdparse.y: In function `yyparse': /freebsd/frog/src/usr.sbin/apmd/apmdparse.y:101: warning: assignment makes integer from pointer without a cast /freebsd/frog/src/usr.sbin/apmd/apmdparse.y:105: warning: assignment makes integer from pointer without a cast cc -O -pipe -mcpu=pentiumpro -I. -I/freebsd/frog/src/usr.sbin/apmd -o apmd apmd.o apmdlex.o apmdparse.o -ll >Fix: --- apmd.diff begins here --- Index: src/usr.sbin/apmd/apmdparse.y =================================================================== RCS file: /usr/home/ncvs/src/usr.sbin/apmd/apmdparse.y,v retrieving revision 1.3 diff -u -r1.3 apmdparse.y --- src/usr.sbin/apmd/apmdparse.y 15 May 2001 05:13:45 -0000 1.3 +++ src/usr.sbin/apmd/apmdparse.y 28 Feb 2003 01:53:46 -0000 @@ -56,7 +56,7 @@ %token APMEVENT %token APMBATT %token BATTCHARGE BATTDISCHARGE -%token BATTTIME BATTPERCENT +%token BATTTIME BATTPERCENT %token EXECCMD REJECTCMD %token EVENT %token STRING UNKNOWN --- apmd.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 13:52:52 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0303F37B401; Fri, 28 Feb 2003 13:52:51 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 93EC243F75; Fri, 28 Feb 2003 13:52:50 -0800 (PST) (envelope-from keramida@FreeBSD.org) Received: from freefall.freebsd.org (keramida@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SLqoNS036221; Fri, 28 Feb 2003 13:52:50 -0800 (PST) (envelope-from keramida@freefall.freebsd.org) Received: (from keramida@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SLqoBp036217; Fri, 28 Feb 2003 13:52:50 -0800 (PST) Date: Fri, 28 Feb 2003 13:52:50 -0800 (PST) From: Giorgos Keramidas Message-Id: <200302282152.h1SLqoBp036217@freefall.freebsd.org> To: vova@sw.ru, keramida@FreeBSD.org, freebsd-bugs@FreeBSD.org, keramida@FreeBSD.org Subject: Re: kern/39297: Have random panic somewhere near console driver on fresh current Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: Have random panic somewhere near console driver on fresh current State-Changed-From-To: open->closed State-Changed-By: keramida State-Changed-When: Fri Feb 28 13:51:05 PST 2003 State-Changed-Why: 5.0-CURRENT has changed quite a lot since this was submitted. This is very unlikely to be relevant anymore. BTW, you should try mailing freebsd-current instead of filing a bug report for the -CURRENT branch of development. Responsible-Changed-From-To: freebsd-bugs->keramida Responsible-Changed-By: keramida Responsible-Changed-When: Fri Feb 28 13:51:05 PST 2003 Responsible-Changed-Why: http://www.freebsd.org/cgi/query-pr.cgi?pr=39297 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 14: 9:13 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02CFA37B405; Fri, 28 Feb 2003 14:09:13 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F95143F93; Fri, 28 Feb 2003 14:09:10 -0800 (PST) (envelope-from keramida@FreeBSD.org) Received: from freefall.freebsd.org (keramida@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SM9ANS041503; Fri, 28 Feb 2003 14:09:10 -0800 (PST) (envelope-from keramida@freefall.freebsd.org) Received: (from keramida@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SM97rk041499; Fri, 28 Feb 2003 14:09:07 -0800 (PST) Date: Fri, 28 Feb 2003 14:09:07 -0800 (PST) From: Giorgos Keramidas Message-Id: <200302282209.h1SM97rk041499@freefall.freebsd.org> To: soralx@cydem.zp.ua, keramida@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: misc/41772: can't disable keybell Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Synopsis: can't disable keybell State-Changed-From-To: feedback->closed State-Changed-By: keramida State-Changed-When: Fri Feb 28 14:07:44 PST 2003 State-Changed-Why: Pilot error. Setting keybell to NO doesn't disable beeping. Hopefully similar misunderstandings will be avoided in the future after my recent commit to rc.conf.5 that documents keybell and points to kbdcontrol(1). http://www.freebsd.org/cgi/query-pr.cgi?pr=41772 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 14:40: 5 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7332337B401 for ; Fri, 28 Feb 2003 14:40:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 220E543FA3 for ; Fri, 28 Feb 2003 14:40:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1SMe4NS047618 for ; Fri, 28 Feb 2003 14:40:04 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1SMe3eB047617; Fri, 28 Feb 2003 14:40:03 -0800 (PST) Date: Fri, 28 Feb 2003 14:40:03 -0800 (PST) Message-Id: <200302282240.h1SMe3eB047617@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ceri Davies Subject: Re: bin/48749: inetd depends on portmap Reply-To: Ceri Davies Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/48749; it has been noted by GNATS. From: Ceri Davies To: Scott Ballantyne Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: bin/48749: inetd depends on portmap Date: Fri, 28 Feb 2003 22:31:53 +0000 On Thu, Feb 27, 2003 at 03:18:57PM -0000, Scott Ballantyne wrote: > Or add a comment to the appropriate place in the inetd.conf > file for morons like me:-) Something like this, you mean ? # RPC based services (you MUST have portmapper running to use these) # #rstatd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rstatd rpc.rstatd #rusersd/1-2 dgram rpc/udp wait root /usr/libexec/rpc.rusersd rpc.rusersd #walld/1 dgram rpc/udp wait root /usr/libexec/rpc.rwalld rpc.rwalld #pcnfsd/1-2 dgram rpc/udp wait root /usr/libexec/rpc.pcnfsd rpc.pcnfsd #rquotad/1 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad #sprayd/1 dgram rpc/udp wait root /usr/libexec/rpc.sprayd rpc.sprayd Ceri To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 16:10:21 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78AE337B401 for ; Fri, 28 Feb 2003 16:10:18 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 158AD43FB1 for ; Fri, 28 Feb 2003 16:10:18 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h210AHNS075905 for ; Fri, 28 Feb 2003 16:10:17 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h210AHTV075904; Fri, 28 Feb 2003 16:10:17 -0800 (PST) Date: Fri, 28 Feb 2003 16:10:17 -0800 (PST) Message-Id: <200303010010.h210AHTV075904@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ceri Davies Subject: Re: bin/48749: inetd depends on portmap Reply-To: Ceri Davies Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/48749; it has been noted by GNATS. From: Ceri Davies To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/48749: inetd depends on portmap Date: Sat, 1 Mar 2003 00:03:37 +0000 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline For the audit trail. --RnlQjJ0d97Da+TV1 Content-Type: message/rfc822 Content-Disposition: inline Return-path: Envelope-to: ceri@submonkey.net Delivery-date: Sat, 01 Mar 2003 00:00:47 +0000 Received: from shaft.techsupport.co.uk ([212.250.77.214]) by rhadamanth.submonkey.net with esmtp (TLSv1:EDH-RSA-DES-CBC3-SHA:168) (Exim 4.12) id 18ouQp-0001mq-00 for ceri@submonkey.net; Sat, 01 Mar 2003 00:00:47 +0000 Received: from mx2.freebsd.org ([216.136.204.119]) by shaft.techsupport.co.uk with esmtp (Exim 4.12) id 18ouQo-000NNS-00 for ceri@submonkey.net; Sat, 01 Mar 2003 00:00:46 +0000 Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 8031C5558B for ; Fri, 28 Feb 2003 16:00:45 -0800 (PST) (envelope-from sdb@ssr.com) Received: by hub.freebsd.org (Postfix) id 7DA5237B405; Fri, 28 Feb 2003 16:00:45 -0800 (PST) Delivered-To: ceri@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A68537B401 for ; Fri, 28 Feb 2003 16:00:45 -0800 (PST) Received: from redhotmomma.ssr.com (ns.ssr.com [199.4.235.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 59D3C43F85 for ; Fri, 28 Feb 2003 16:00:44 -0800 (PST) (envelope-from sdb@ssr.com) Received: (qmail 15086 invoked from network); 28 Feb 2003 23:59:50 -0000 Received: from kimchee.ssr.com (199.4.235.5) by ns.ssr.com with QMQP; 28 Feb 2003 23:59:50 -0000 Date: 28 Feb 2003 23:59:40 -0000 Message-ID: <20030228235940.278.qmail@kimchee.ssr.com> From: Scott Ballantyne To: ceri@FreeBSD.org In-reply-to: <20030228223153.GA3569@submonkey.net> (message from Ceri Davies on Fri, 28 Feb 2003 22:31:53 +0000) Subject: Re: bin/48749: inetd depends on portmap References: <20030227151857.2180.qmail@kimchee.ssr.com> <20030228223153.GA3569@submonkey.net> X-Spam-Status: No, hits=-9.8 required=5.0 tests=AWL,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Yes, or perhaps "warning: portmap may not be enabled by default" would be better. Thanks! Scott -- sdb@ssr.com > Date: Fri, 28 Feb 2003 22:31:53 +0000 > From: Ceri Davies > Cc: FreeBSD-gnats-submit@FreeBSD.org > Mail-Followup-To: Ceri Davies , > Scott Ballantyne , FreeBSD-gnats-submit@FreeBSD.org > Content-Disposition: inline > Sender: Ceri Davies > > On Thu, Feb 27, 2003 at 03:18:57PM -0000, Scott Ballantyne wrote: > > > Or add a comment to the appropriate place in the inetd.conf > > file for morons like me:-) > > Something like this, you mean ? > > # RPC based services (you MUST have portmapper running to use these) > # > #rstatd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rstatd rpc.rstatd > #rusersd/1-2 dgram rpc/udp wait root /usr/libexec/rpc.rusersd rpc.rusersd > #walld/1 dgram rpc/udp wait root /usr/libexec/rpc.rwalld rpc.rwalld > #pcnfsd/1-2 dgram rpc/udp wait root /usr/libexec/rpc.pcnfsd rpc.pcnfsd > #rquotad/1 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad > #sprayd/1 dgram rpc/udp wait root /usr/libexec/rpc.sprayd rpc.sprayd > > > Ceri > --RnlQjJ0d97Da+TV1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 19:39: 0 2003 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CAC7137B401; Fri, 28 Feb 2003 19:38:44 -0800 (PST) Received: from mel-rto2.wanadoo.fr (smtp-out-2.wanadoo.fr [193.252.19.254]) by mx1.FreeBSD.org (Postfix) with ESMTP id E71C043FA3; Fri, 28 Feb 2003 19:38:42 -0800 (PST) (envelope-from pmiioijhi@list.ru) Received: from mel-rta6.wanadoo.fr (193.252.19.26) by mel-rto2.wanadoo.fr (6.7.015) id 3E0C3370028C6CBC; Sat, 1 Mar 2003 04:23:33 +0100 Received: from billsrv (217.128.212.103) by mel-rta6.wanadoo.fr (6.7.015) id 3E26CE21018F73F6; Sat, 1 Mar 2003 04:23:33 +0100 Message-ID: <3E26CE21018F73F6@mel-rta6.wanadoo.fr> (added by postmaster@wanadoo.fr) Received: from ALagny-101-1-4-107.abo.wanadoo.fr ([217.128.203.107]) by billsrv (602Pro LAN SUITE v. 2002) id 2e5b6895; Sat, 1 Mar 2003 4:26:26 +0100 Reply-To: pmiioijhi@list.ru From: ***Клиника Альтра-Вита*** Subject: Бесплодие женское и мужское Date: Sat, 1 Mar 2003 05:23:24 +0200 MIME-Version: 1.0 Content-Type: text/html; charset="Windows-1251" Content-Transfer-Encoding: 7bit X-Priority: 1 X-MSMail-Priority: High X-Mailer: Microsoft Outlook Express 6.00.2800.1081 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1081 To: undisclosed-recipients: ; Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org

БЕСПЛОДИЕ – ЭТО НЕ ПРИГОВОР

СОВРЕМЕННЫЕ РЕПРОДУКТИВНЫЕ ТЕХНОЛОГИИ МОГУТ ПОМОЧЬ ДАЖЕ В САМЫХ СЛОЖНЫХ СЛУЧАЯХ

 

Суперсовременная специализированная клиника по лечению бесплодия проводит точную диагностику и эффективное лечение всех форм мужского и женского бесплодия.

 

Новейшее американское оборудование, опытные специалисты – репродуктологи, прошедшие стажировку за рубежом, высочайший уровень комфорта и теплое отношение персонала – все это вы найдете в нашей клинике.

 

Мы применяем новейшие методы лечения бесплодия включая ЭКО, ИКСИ, ТЕСА и др.

 

Подробную информацию вы можете получить по телефону : 127-39-36









SFSRRZUWUVCXBKXORSCYHJNZDWKJOZSGJVTMXE To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 22:43:41 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F2F337B401 for ; Fri, 28 Feb 2003 22:40:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 022A943F75 for ; Fri, 28 Feb 2003 22:40:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h216e8NS073021 for ; Fri, 28 Feb 2003 22:40:08 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h216e8GL073020; Fri, 28 Feb 2003 22:40:08 -0800 (PST) Date: Fri, 28 Feb 2003 22:40:08 -0800 (PST) Message-Id: <200303010640.h216e8GL073020@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ed.Alley.wea@llnl.gov Subject: kern/47982: Minix file-system offered Reply-To: Ed.Alley.wea@llnl.gov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/47982; it has been noted by GNATS. From: Ed.Alley.wea@llnl.gov To: FreeBSD-gnats-submit@freebsd.org Cc: wea@llnl.gov Subject: kern/47982: Minix file-system offered Date: Fri, 28 Feb 2003 22:30:31 -0800 (PST) >Submitter-Id: current-users >Originator: Ed Alley >Organization: Lawrence Livermore National Laboratory >Confidential: no >Synopsis: kern/47982: Minix file-system offered >Severity: non-critical >Priority: low >Category: kern >Class: update >Release: FreeBSD 4.6.2-RELEASE i386 >Environment: System: FreeBSD jordan.llnl.gov FreeBSD 4.6.2-RELEASE #0: i386 >Description: RE: PR kern/47982 This is an update of my previous submission. The previous submitted patch should be discarded. I have added inode hashing, and the ability to operate with data zone sizes that can contain a power of two number of contiguous data blocks. This is supposed to make disk reads a little more efficient in Minix lore, but I put it in for compatability reasons. I have also fixed some bugs that either corrupted the FS or in one case caused a random page-fault. This was traced to the root inode pointer getting trashed when its vnode was released and re-assigned through the vnode cache process. Other bugs occured during renameing of files and directories after a remove has been performed. (Boy! VOPS_RENAME(9) is sure a subtle routine; I worked a long time on that one and am still not 100% sure about it.) >How-To-Repeat: Not applicable >Fix: Rather than submit one huge patch on /usr/src, I have submitted two patches: one for /usr/src/sbin, and one for /usr/src/sys. The patches are demarked by the line: 8><------------------------------------------------- Cut here The sources have been diffed against FreeBSD 4.6.2. To apply the /sbin patch: cd /usr/src patch -p0 < sbin.patch To apply the /kernel patch: cd /usr/src patch -p0 < sys.patch Ed Alley FOLLOWING is the SBIN PATCH: 8><------------------------------------------------- Cut here diff -ruN sbin.orig/Makefile sbin/Makefile --- sbin.orig/Makefile Mon Mar 18 00:40:00 2002 +++ sbin/Makefile Fri Feb 28 13:44:16 2003 @@ -78,7 +78,7 @@ vinum .if ${MACHINE_ARCH} == i386 -SUBDIR+= kget mount_nwfs mount_smbfs +SUBDIR+= kget mount_nwfs mount_smbfs mount_minix newfs_minix .endif .if exists(${.CURDIR}/${MACHINE}) diff -ruN sbin.orig/mount_minix/Makefile sbin/mount_minix/Makefile --- sbin.orig/mount_minix/Makefile Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/Makefile Fri Feb 28 13:54:39 2003 @@ -0,0 +1,10 @@ + +PROG= mount_minixfs +SRCS= mount_minixfs.c getmntopts.c +MAN= mount_minixfs.8 + +MOUNT= ${.CURDIR}/../mount +CFLAGS+= -I${MOUNT} +.PATH: ${MOUNT} + +.include diff -ruN sbin.orig/mount_minix/bsd-copyright sbin/mount_minix/bsd-copyright --- sbin.orig/mount_minix/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/bsd-copyright Fri Feb 28 13:50:57 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sbin.orig/mount_minix/mount_minixfs.8 sbin/mount_minix/mount_minixfs.8 --- sbin.orig/mount_minix/mount_minixfs.8 Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/mount_minixfs.8 Fri Feb 28 13:55:27 2003 @@ -0,0 +1,44 @@ + +.Dd November 5, 2002 +.Dt MOUNT_MINIXFS 8 +.Os +.Sh NAME +.Nm mount_minixfs +.Nd mount a minixfs file system +.Sh SYNOPSIS +.Nm +.Op Fl o Ar options +.Ar special +.Ar node +.Sh DESCRIPTION +The +.Nm +command attaches a minixfs file system +.Ar special +device on to the file system tree at the point +.Ar node . +.Pp +This command is normally executed by +.Xr mount 8 +at boot time. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl o +Options are specified with a +.Fl o +flag followed by a comma separated string of options. +See the +.Xr mount 8 +man page for possible options and their meanings. +.El +.Sh SEE ALSO +.Xr mount 2 , +.Xr unmount 2 , +.Xr fstab 5 , +.Xr mount 8 +.Sh HISTORY +The +.Nm +function first appeared in +.Fx 4.6 . diff -ruN sbin.orig/mount_minix/mount_minixfs.c sbin/mount_minix/mount_minixfs.c --- sbin.orig/mount_minix/mount_minixfs.c Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/mount_minixfs.c Fri Feb 28 13:52:40 2003 @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "mntopts.h" + +struct mntopt mopts[] = { + MOPT_STDOPTS, + MOPT_FORCE, + MOPT_SYNC, + MOPT_UPDATE, + { NULL } +}; + +static void usage __P((void)) __dead2; + +int +main(argc, argv) + int argc; + char *argv[]; +{ + struct ufs_args args; + int ch, mntflags; + char *fs_name, *options, mntpath[MAXPATHLEN]; + struct vfsconf vfc; + int error; + + options = NULL; + mntflags = 0; + while ((ch = getopt(argc, argv, "o:")) != -1) + switch (ch) { + case 'o': + getmntopts(optarg, mopts, &mntflags, 0); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 2) + usage(); + + args.fspec = argv[0]; /* the name of the device file */ + fs_name = argv[1]; /* the mount point */ + + /* + * Resolve the mountpoint with realpath(3) and remove unnecessary + * slashes from the devicename if there are any. + */ + (void)checkpath(fs_name, mntpath); + (void)rmslashes(args.fspec, args.fspec); + +#define DEFAULT_ROOTUID -2 + args.export.ex_root = DEFAULT_ROOTUID; + if (mntflags & MNT_RDONLY) + args.export.ex_flags = MNT_EXRDONLY; + else + args.export.ex_flags = 0; + + error = getvfsbyname("minixfs", &vfc); + if (error && vfsisloadable("minixfs")) { + if (vfsload("minixfs")) { + err(EX_OSERR, "vfsload(minixfs)"); + } + endvfsent(); /* flush cache */ + error = getvfsbyname("minixfs", &vfc); + } + if (error) + errx(EX_OSERR, "minixfs filesystem is not available"); + + if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0) + err(EX_OSERR, "%s", args.fspec); + exit(0); +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: mount_minixfs [-o options] special node\n"); + exit(EX_USAGE); +} diff -ruN sbin.orig/newfs_minix/Makefile sbin/newfs_minix/Makefile --- sbin.orig/newfs_minix/Makefile Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/Makefile Fri Feb 28 13:44:15 2003 @@ -0,0 +1,32 @@ +# Copyright (c) 2003 Ed Alley: wea@llnl.gov +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +PROG= newfs_minix +SRCS= main.c super.c blockio.c inodeio.c zoneio.c dirio.c misc.c +MAN= newfs_minix.8 + +LINKS= ${BINDIR}/newfs_minix ${BINDIR}/mount_minixfs +MLINKS= newfs_minix.8 mount_minixfs.8 + +.include diff -ruN sbin.orig/newfs_minix/blockio.c sbin/newfs_minix/blockio.c --- sbin.orig/newfs_minix/blockio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/blockio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "mkfs.h" + +#include + +void +insert_bit(block_t block, int bit) +{ + /* Inserts a bit in a bitmap */ + + int w, s; + short buf[BLOCK_SIZE / sizeof(short)]; + + get_block(block, (char*)buf); + + w = bit / (8 * sizeof(short)); + s = bit % (8 * sizeof(short)); + + buf[w] |= (1 << s); + + put_block(block, (char*)buf); +} + +int +read_bit(block_t block, int bit) +{ + /* Returns a bit in a bitmap */ + + int w, s; + short buf[BLOCK_SIZE/sizeof(short)]; + + get_block(block, (char *)buf); + + w = bit / (8 * sizeof(short)); + s = bit % (8 * sizeof(short)); + + return ((int)((buf[w] >> s) & 0x1)); +} + +void +get_block (block_t block, char *buf) +{ + bcopy (zone[block].store, buf, BLOCK_SIZE); +} + +void +put_block (block_t block, char *buf) +{ + bcopy (buf, zone[block].store, BLOCK_SIZE); + +} diff -ruN sbin.orig/newfs_minix/bsd-copyright sbin/newfs_minix/bsd-copyright --- sbin.orig/newfs_minix/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/bsd-copyright Fri Feb 28 13:44:15 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sbin.orig/newfs_minix/dirio.c sbin/newfs_minix/dirio.c --- sbin.orig/newfs_minix/dirio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/dirio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The following code was slightly modified from Minix's mkfs.c with permission. + */ + +#include "mkfs.h" + +void rootdir(mino_t inode) +{ + /* + Get a zone for the root directory and + add the two entries for '.' and '..' + The length of a single directory entry is + 16 bytes; hence, 32 for two directories. + */ + + add_zone(inode, alloc_zone(), 32L, current_time); + + /* + Add the directory entries for the root directory. + (note that the parent and child inodes are the same) + */ + + enter_dir(inode, ".", inode); + enter_dir(inode, "..", inode); + + /* increment the link counts */ + + incr_link(inode); + incr_link(inode); +} + + +void +incr_link(mino_t n) +{ + /* Increment the link count to inode n */ + + int off; + block_t b; + inode_t inode2[V2_INODES_PER_BLOCK]; + + b = ((n - 1) / inodes_per_block) + inode_offset; + off = (n - 1) % inodes_per_block; + + get_block(b, (char *) inode2); + inode2[off].i_nlinks++; + put_block(b, (char *) inode2); +} + +void +enter_dir(mino_t parent, char *name, mino_t child) +{ + /* Enter child in parent directory */ + /* Works for dir > 1 block and zone > block */ + + int i, j, k, l, off; + block_t b; + zone_t z; + char *p1, *p2; + struct direct dir_entry[NR_DIR_ENTRIES]; + inode_t ino2[V2_INODES_PER_BLOCK]; + int nr_dzones; + + b = ((parent - 1) / inodes_per_block) + inode_offset; + off = (parent - 1) % inodes_per_block; + + get_block(b, (char *) ino2); + nr_dzones = V2_NR_DZONES; + + for (k = 0; k < nr_dzones; k++) { + z = ino2[off].i_zone[k]; + if (z == 0) { + z = alloc_zone(); + ino2[off].i_zone[k] = z; + } + for (l = 0; l < zone_size; l++) { + get_block((z << zone_shift) + l, (char *) dir_entry); + for (i = 0; i < NR_DIR_ENTRIES; i++) { + if (dir_entry[i].d_ino == 0) { + dir_entry[i].d_ino = child; + p1 = name; + p2 = dir_entry[i].d_name; + j = 14; + while (j--) { + *p2++ = *p1; + if (*p1 != 0) p1++; + } + put_block((z << zone_shift) + l, (char *) dir_entry); + put_block(b, (char *) ino2); + return; + } + } + } + } + + printf("Directory-inode %d beyond direct blocks. Could not enter %s\n", + parent, name); + exit(1); +} diff -ruN sbin.orig/newfs_minix/inodeio.c sbin/newfs_minix/inodeio.c --- sbin.orig/newfs_minix/inodeio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/inodeio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "mkfs.h" + +/* + Returns a free inode number and marks it active +*/ + +mino_t +get_inode(void) +{ + mino_t num; + block_t inodemap; + int bit; + + /* loop over inodes */ + + for (num=1; num +#include +#include + +int zone_size, zone_map, zone_shift; +int zoff; +int inodes_per_block; +int inode_offset; +int nrblocks, nrnodes; +long current_time; +zone_t nrzones; +unsigned int nrinodes; +Zone_t *zone; +char zero[BLOCK_SIZE]; + +#define MAX_BLOCKS (1024L * 1024) +#define MAX_INODES ((unsigned) 65535) + +void super(super_block_t*, zone_t, mino_t); +void usage(int,char*); + +int +main(int argc, char **argv) +{ + int c, i, s, fdo, no_output; + super_block_t sp[1]; + struct timeval timestr; + int mode; + char *ch, *fname = (char*)NULL; + char defname[] = {"flimage"}; + + /* The following default values are for a 1440K floppy fs */ + + nrblocks = 1440; + nrinodes = 0; + zone_shift = 0; + no_output = 0; + + while(1) { + if ((s = getopt(argc, argv, ":hNi:b:s:")) == -1) { + fname = argv[optind++]; + break; + } + switch (s) { + case 'h': + usage(0,(char*)NULL); + break; + case 'i': + ch = optarg; + for (i=0; i MAX_BLOCKS) + usage(1, "nrblocks greater than (1024 X 1024)"); + + if (nrinodes == 0) { + /* The default for inodes is 3 blocks per inode, rounded up + * to fill an inode block. Above 20M, the average files are + * sure to be larger because it is hard to fill up 20M with + * tiny files, so reduce the default number of inodes. This + * default can always be overridden by using the -i option. + */ + nrinodes = nrblocks / 3; + if (nrblocks >= 20000) nrinodes = nrblocks / 4; + if (nrblocks >= 40000) nrinodes = nrblocks / 5; + if (nrblocks >= 60000) nrinodes = nrblocks / 6; + if (nrblocks >= 80000) nrinodes = nrblocks / 7; + if (nrblocks >= 100000) nrinodes = nrblocks / 8; + nrinodes += inodes_per_block - 1; + nrinodes = nrinodes / inodes_per_block * inodes_per_block; + if (nrinodes > MAX_INODES) nrinodes = MAX_INODES; + } + + if (nrinodes < 1) + usage(1, "Inode count too small"); + + if (nrinodes > MAX_INODES) + usage(1, "Inode count too large"); + + if (fname == NULL && !no_output) { + usage(1, "No special file provided"); + } + + zone_size = BLOCK_SIZE << zone_shift; + nrzones = nrblocks >> zone_shift; + if ((nrzones << zone_shift) < nrblocks) + nrzones++; + + printf("block size = 1024 bytes\n"); + printf("zone size = %d bytes\n",(int)zone_size); + printf("number of blocks = %d\n",(int)nrblocks); + printf("number of zones = %d\n",(int)nrzones); + printf("zone shift = %d\n",(int)zone_shift); + + zone = (Zone_t*)malloc(nrzones*zone_size); + + bzero((char*)zone, nrzones*zone_size); + + gettimeofday(×tr, NULL); + current_time = timestr.tv_sec; /* UNIX time in seconds */ + + /* Set up a block of zeros */ + + bzero(zero, BLOCK_SIZE); + + /* Set up the superblock */ + + super(sp, nrzones, nrinodes); + + /* The superblock goes into block[1]. */ + + zone[1].sp = sp[0]; + + zone_map = INODE_MAP + sp->s_imap_blocks; + zone_size = 1 << zone_shift; /* Re-define zone_size */ + zoff = sp->s_firstdatazone - 1; + + insert_bit(INODE_MAP, 0); /* inode zero is not used but must be allocated */ + insert_bit(zone_map, 0); /* bit zero must always be allocated in zone map */ + + /* + Set the mode and rwx bits for the root directory + */ + + mode = 040755; /* drwxr_xr_x */ + + rootdir(alloc_inode(mode, getuid(), getgid())); + + if (!no_output) { + + if ((fdo = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) { + printf("Can't open file: %s; Quitting!\n",fname); + exit(1); + } + + /* Write out the blocks */ + + for (i=0; i> BITMAPSHIFT + * + * doesn't work because of overflow. + * + * Other overflow bugs, such as the expression for N_ILIST overflowing when + * s_inodes is just over INODES_PER_BLOCK less than the maximum+1, are not + * fixed yet, because that number of inodes is silly. + */ + +/* The above comment doesn't all apply now bit_t is ulong. Overflow is now + * unlikely, but negative bit counts are now possible (though unlikely) + * and give silly results. + */ + +int +bitmapsize(bit_t nr_bits) +{ + int nr_blocks; + + nr_blocks = (int) (nr_bits >> BITMAPSHIFT); + + if (((bit_t) nr_blocks << BITMAPSHIFT) < nr_bits) + ++nr_blocks; + + return nr_blocks; +} diff -ruN sbin.orig/newfs_minix/mkfs.h sbin/newfs_minix/mkfs.h --- sbin.orig/newfs_minix/mkfs.h Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/mkfs.h Fri Feb 28 13:44:15 2003 @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + /*************************************************************************** + * * + * Minix File System * + * * + * The guide for these sources comes from Andrew Tannenbaum's MINIX * + * source which can be gotten from the official MINIX home page: * + * http://www.cs.vu.nl/~ast/minix.html * + * Some of the names have been changed to avoid conflicts with FBSD. ;) * + * * + * For further information there is also the book: * + * Tannenbaum and Woodhull, * + * "Operating Systems Design and Implememtation", 2nd ed, 1997 * + * from Prentice Hall, New Jersey * + * * + ****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include + +/* + * In the definitions that follow, a zone is a block. + * There exists the possiblity that a zone can be + * a power of two larger than a block; that is the + * function of the variable s_log_zone_size in the + * super block which represents the shift needed + * to go from blocks to zones and back again. + */ + +#define BLOCK_SIZE 1024 /* # bytes in a disk block */ + +#define BITS_PER_BLOCK 8192 /* 8*BLOCK_SIZE */ +#define BITMAPSHIFT 13 /* log2(BITS_PER_BLOCK) */ + +#define INODE_MAP 2 /* position of first inode bitmap */ + +#define V2_NR_DZONES 7 +#define V2_NR_TZONES 10 +#define NR_INODES 64 +#define V2_INODE_SIZE 64 /* sizeof(inode_t) */ +#define V2_ZONE_NUM_SIZE 4 /* sizeof(zone_t) = 32 bits */ +#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE) +#define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /* # zones/indir block */ + +/* The type of sizeof may be (unsigned) long. Use the following macro for + * taking the sizes of small objects so that there are no surprises like + * (small) long constants being passed to routines expecting an int. + */ + +#define usizeof(t) ((unsigned) sizeof(t)) + +/* Types used in disk, inode, etc. data structures. */ +typedef unsigned short mino_t; /* i-node number */ +typedef unsigned short mmode_t; /* file type and permissions bits */ +typedef unsigned long moff_t; /* offset within a file */ +typedef unsigned short zone1_t; /* zone number for V1 file systems */ +typedef unsigned long zone_t; /* zone number */ +typedef unsigned long block_t; /* block number */ +typedef unsigned long bit_t; /* bit number in a bitmap */ +typedef unsigned short bitchunk_t; /* a collection of bits from a bitmap */ +typedef long mtime_t; /* time in sec since 1 Jan 1970 0000 GMT */ + +/* File system types. */ +#define SUPER_MAGIC 0x137F /* magic number contained in super-block */ +#define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */ +#define SUPER_V2 0x2468 /* magic # for V2 file systems */ +#define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */ + +/* Directory layout */ +#define DIRBLKSIZ 512 +#define DIRSIZ 14 + +struct direct { + mino_t d_ino; /* 2 */ + char d_name[DIRSIZ]; /* 14 */ +}; + +#define DIR_ENTRY_SIZE usizeof(struct direct) +#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) + +/* Structure of the superblock on disk */ + +typedef struct { + mino_t s_ninodes; /* # usable inodes on the minor device */ + zone1_t s_nzones; /* total device size, including bit maps etc */ + short s_imap_blocks; /* # of blocks used by inode bit map */ + short s_zmap_blocks; /* # of blocks used by zone bit map */ + zone1_t s_firstdatazone; /* number of first data zone */ + short s_log_zone_size; /* log2 of blocks/zone */ + moff_t s_max_size; /* maximum file size on this device */ + short s_magic; /* magic number to recognize super-blocks */ + short s_pad; /* try to avoid compiler-dependent padding */ + zone_t s_zones; /* number of zones (replaces s_nzones in V2) */ + char pad[1000]; /* pad the block to 1024 bytes */ +} super_block_t; + +/* Structure of an inode on disk. length = 64 bytes. */ + +typedef struct { + mmode_t i_mode; /* file type, protection, etc. 2 */ + short i_nlinks; /* how many links to this file 2 */ + short i_uid; /* user id of the file's owner 2 */ + short i_gid; /* group number 2 */ + moff_t i_size; /* current file size in bytes 4 */ + mtime_t i_atime; /* time of last access (V2 only) 4 */ + mtime_t i_mtime; /* when was file data last changed 4 */ + mtime_t i_ctime; /* when was inode itself changed (V2 only) 4 */ + zone_t i_zone[V2_NR_TZONES]; /* zone numbers for direct, ind, and dbl ind 40 */ +} inode_t; + +/* A zone can be inodes, a bootblock, a superblock or data */ +/* This definition really defines the possible structure of a block */ + +typedef union { + inode_t inode[16]; + super_block_t sp; + struct boot_block_s { + char bootblock[294]; + char pad[730]; + } boot_block; + char store[1024]; +} Zone_t; + +void insert_bit (block_t, int); +int read_bit (block_t, int); +mino_t get_inode(void); +void get_block (block_t, char*); +void put_block (block_t, char*); +void rootdir(mino_t); +zone_t alloc_zone(void); +mino_t alloc_inode(int , int, int); +void add_zone(mino_t, zone_t, long, long); +void incr_link(mino_t); +void enter_dir(mino_t, char*, mino_t); + +/* These variable are defined in main and used throughout */ + +extern Zone_t *zone; +extern int zone_size, zone_map, zone_shift; +extern int zoff; +extern char zero[BLOCK_SIZE]; +extern int inodes_per_block; +extern int inode_offset; +extern int nrblocks, nrnodes; +extern long current_time; +extern zone_t nrzones; +extern unsigned int nrinodes; diff -ruN sbin.orig/newfs_minix/newfs_minix.8 sbin/newfs_minix/newfs_minix.8 --- sbin.orig/newfs_minix/newfs_minix.8 Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/newfs_minix.8 Fri Feb 28 13:56:11 2003 @@ -0,0 +1,59 @@ + +.Dd February 28, 2003 +.Dt NEWFS_MINIX 8 +.Os +.Sh NAME +.Nm newfs_minix +.Nd construct a new Minix file system +.Sh SYNOPSIS +.Nm +.Op Fl N +.Op Fl b Ar number-of-blocks +.Op Fl i Ar number-of-inodes +.Op Fl s Ar zone-shift +.Ar special +.Sh DESCRIPTION +The +.Nm +utility is used to initialize and clear the Minix +filesystem on device +.Ar special. +(We often refer to the +.Dq special file +as the +.Dq disk , +although the special file need not be a physical disk. +In fact, it need not even be special.) +Without options +.Nm +will make a file system that will fit on a 1.44MB +floppy disk, however, +.Nm +has some options to allow the defaults to be selectively overridden. +.Pp +The following options define the general layout policies: +.Bl -tag -width indent +.It Fl b Ar number-of-blocks +The total number of blocks of 1024 bytes each that the FS will contain. +If this option is not provided then 1440 blocks are chosen. +.It Fl i Ar number-of-inodes +The number of inode in the FS. If this option is not provided then +the number of inodes will be calculated to be roughly 1/3 of the +number of blocks. +.It Fl s Ar zone-shift +The log2 of the number of blocks/zone. The FS can be designed to be +made up of data zones that contain a power of two contiguous blocks +in them. The default for this parameter is zero. +.It Fl N +Cause the file system parameters to be printed out +without really creating the file system. +.Sh SEE ALSO +.Xr mount 8 , +.Xr mount_minixfs 8 +.Sh AUTHOR +.An Ed Alley +.Sh HISTORY +The +.Nm +command first appeared in +.Bx 4.6.2 . diff -ruN sbin.orig/newfs_minix/super.c sbin/newfs_minix/super.c --- sbin.orig/newfs_minix/super.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/super.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* The following code was lifted and modified from the minix source with permission. */ + +#include "mkfs.h" + +int bitmapsize(bit_t); + +void +super(super_block_t *sp, zone_t nzones, mino_t ninodes) +{ + zone_t maxsize; + zone_t fstblk, fstzon; + short impsize, zmpsize; + int i, inoblks; + + /* + The maximum file size is the cube of the number of indirects + plus the square of the number of indirects plus the number of + indirects plus the number of direct entries in the inode times + the number of bytes in a zone. This can be a very large number, + (more than 32 bits of addressing can manage). + */ + + /* With triple indirects just put the 2GB limit as the max size */ + + maxsize = ~(1 << 31); /* All bits are ones except the sign bit */ + + /* maxsize is then (2^31 - 1) = 2,147,483,647 bytes */ + + /* + bitmapsize() returns the number of blocks in a bitmap + */ + + impsize = bitmapsize((bit_t) (1 + ninodes)); + zmpsize = bitmapsize((bit_t) nzones); + + printf("blocks in imap = %d\n",impsize); + printf("blocks in zmap = %d\n",zmpsize); + + /* + The number of blocks to the beginning of the inodes + */ + + inode_offset = impsize + zmpsize + 2; + + printf("inode offset = %d\n", inode_offset); + + /* The number blocks that contain inodes */ + + inoblks = (ninodes + inodes_per_block - 1)/inodes_per_block; + + printf("inode blocks = %d\n",inoblks); + + /* + The number of blocks to the beginning of the data + gives the location of the first data zone. + */ + + fstblk = inode_offset + inoblks; /* Number of 1K blocks */ + fstzon = (fstblk + (1 << zone_shift) - 1) >> zone_shift; + + printf("first data zone = %d\n",(int)fstzon); + printf("first data block = %d\n",(int)(fstzon << zone_shift)); + + /* + Construct the V2 superblock + */ + + sp->s_ninodes = ninodes; /* # of inodes */ + sp->s_nzones = 0; /* Not used in V1; forces errors in V2 */ + sp->s_imap_blocks = impsize; /* # of blocks used by inode bit map */ + sp->s_zmap_blocks = zmpsize; /* # of blocks used by zone bit map */ + sp->s_firstdatazone = fstzon; /* index of the first data zone */ + sp->s_log_zone_size = zone_shift; /* log2(blocks/zone) */ + sp->s_max_size = maxsize; /* Maximum file system size */ + sp->s_magic = SUPER_V2; /* Indicates a V2 filesystem */ + sp->s_pad = 0; /* Just padding */ + sp->s_zones = nzones; /* # of zones */ + for (i=0; i<1000; i++) /* Pad the rest of the block with zeros */ + sp->pad[i] = '\0'; +} diff -ruN sbin.orig/newfs_minix/zoneio.c sbin/newfs_minix/zoneio.c --- sbin.orig/newfs_minix/zoneio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/zoneio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,127 @@ +/*- + * Copyright (c) 2003 Ed Alley + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The code below was lifted from Minix's mkfs.c with permission. + */ + +#include "mkfs.h" + +/* + * Returns a free zone/block number and marks it active + */ + +zone_t +get_zone(void) +{ + zone_t num; + block_t znodemap; + int bit; + + /* loop over zones */ + + for (num=1; num block */ + + block_t b; + int i; + zone_t z; + + /* Get a free zone/block and mark it active */ + + z = get_zone(); + + b = z << zone_shift; + + for (i = 0; i < zone_size; i++) + put_block(b + i, zero); /* give an empty zone */ + + return z; /* Returns the absolute zone number in the file */ +} + +void +add_zone(mino_t n, zone_t z, long bytes, long cur_time) +{ + /* Add zone z to inode n. The file has grown by 'bytes' bytes. */ + + int off, i; + block_t b; + zone_t indir; + zone_t blk[V2_INDIRECTS]; + inode_t *p; + inode_t inode[V2_INODES_PER_BLOCK]; + + b = ((n - 1) / V2_INODES_PER_BLOCK) + inode_offset; + off = (n - 1) % V2_INODES_PER_BLOCK; + + get_block(b, (char *) inode); + p = &inode[off]; + p->i_size += bytes; + p->i_mtime = cur_time; + for (i = 0; i < V2_NR_DZONES; i++) + if (p->i_zone[i] == 0) { + p->i_zone[i] = z; + put_block(b, (char *) inode); + return; + } + put_block(b, (char *) inode); + + /* File has grown beyond a small file. */ + + if (p->i_zone[V2_NR_DZONES] == 0) p->i_zone[V2_NR_DZONES] = alloc_zone(); + indir = p->i_zone[V2_NR_DZONES]; + put_block(b, (char *) inode); + b = indir << zone_shift; + get_block(b, (char *) blk); + for (i = 0; i < V2_INDIRECTS; i++) + if (blk[i] == 0) { + blk[i] = z; + put_block(b, (char *) blk); + return; + } + printf("File has grown beyond single indirect"); + exit(1); +} 8><------------------------------------------------- Cut here FOLLOWING is the SYS PATCH: 8><------------------------------------------------- Cut here diff -ruN sys.orig/fs/minixfs/README sys/fs/minixfs/README --- sys.orig/fs/minixfs/README Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/README Fri Feb 28 16:02:15 2003 @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +This is the Minix FS. It was developed on FreeBSD-4.6.x. + +The fs should be located in: "/usr/src/sys/fs/minixfs". There are two other source +files located in /usr/src/sbin/: mount_minixfs(8) is located in the directory: +"mount_minix"; and newfs_minix(8) is located in the directory: newfs_minix. The first +source is needed to mount the FS and the second one will make the FS. The include file: +vnode.h in "/usr/src/sys/sys" is modified in the enum vtagtype statement to include +VT_MINIXFS after the last entry (which at this writing is: VT_SMBFS). The Makefile for +the Minix FS is located in: "/usr/src/sys/modules/minixfs". The Makefile for sbin must +be modified to compile minix_mountfs.c and newfs_minix.c. The Makefile for the modules +must be modified to compile the Minix FS module. I modified the i386 sections of these +Makefiles because the FS only works on the i386 platform. + + Ed diff -ruN sys.orig/fs/minixfs/TODO sys/fs/minixfs/TODO --- sys.orig/fs/minixfs/TODO Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/TODO Fri Feb 28 16:28:01 2003 @@ -0,0 +1,69 @@ +To do list: (Not necessarily in order of importance) + + 1. Modify to allow zone sizes larger than one block. + As of now: zone size = block size = 1024 bytes. + The routine: minix_bmapfs() shows a beginning + in that direction. There is an issue of whether + to save the zone fragments after reading, in case + another block is desired within a previously read + zone. I realize that these issues have already + been delt with in ufs and ext2fs and that these + algorithms should be understood before writing one + for Minix. + (DONE 030213 by Ed Alley) + + 2. Fix ip hashing. + As of now I get a panic (page fault from memory manager) + after a dismount then subsequent remount; the panic + occurs when I first reference the file system after + the remount, for example, by executing ls(1) within + the file system. Because of this I have disabled ip hashing + in this source until I can figure out what is going wrong. + (DONE 030228 by Ed Alley) + + 3. Clean up redundant metadata writes. + This involves reducing the number of 'minix_update()' calls + to a minimum when metadata changes occur; I took a very + conservative approach in building this fs and did not + even consider trying to design it with asynchronous updates + of metadata; as a consequence, there are undoubtably too + many update() calls. + + 4. Make more routines static. + Need to reduce the number of routines with prototypes + lacking the "static" designation to reduce the number + of minix functions with global names. + + 5. Write a minix_fsck routine. + Probably not necessary, because Minix already has one + operating on its side of the fence. But it might be + fun nonetheless. :) + + 6. Make modifications for other platforms. + As of now the Minix fs only works on the i386 platform. + This might be tricky if endian issues are involved. + + 7. Write a newfs_minix routine. + (DONE 030210 by Ed Alley) + + 8. Page fault if module is loaded for days! + I don't understand this one. It seems that + the module will page fault if it is loaded + for days even after being unmounted. If a + fs is mounted, then a page fault will occur. + This can be eliminated by unloading the + module after the last fs is unmounted. + (DONE 020220 by Ed Alley) + + 9. Clean up the directory manipulating routines: + Come up with a way to keep track of holes, + so we don't have to search the directory + each time we need to put an entry in. + Also, fix up the way that the directory + size is determined: right now we just count + the entries until the last is found. + Fix up the way directories are truncated + when they are shortened: right now we just + copy out the existing entries, clean the + directory out and then reload it with the + saved entries. diff -ruN sys.orig/fs/minixfs/bsd-copyright sys/fs/minixfs/bsd-copyright --- sys.orig/fs/minixfs/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/bsd-copyright Fri Feb 28 13:46:38 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sys.orig/fs/minixfs/minix.h sys/fs/minixfs/minix.h --- sys.orig/fs/minixfs/minix.h Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix.h Fri Feb 28 21:07:27 2003 @@ -0,0 +1,373 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/**************************************************************************** + * * + * Minix File System include file * + * * + * The guide for this include file comes from Andrew Tannenbaum's MINIX * + * source which can be gotten from the official MINIX home page: * + * http://www.cs.vu.nl/~ast/minix.html * + * Some of the names have been changed to avoid conflicts with FBSD. ;) * + * * + * For further information there is also the book: * + * Tannenbaum and Woodhull, * + * "Operating Systems Design and Implememtation", 2nd ed, 1997 * + * from Prentice Hall, New Jersey * + * * + ****************************************************************************/ + +#ifndef _SYS_PARAM_H_ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifndef _SYS_MALLOC_H_ +#include +#endif + +#define MINIXFS_VERSION 2 /* Version 2 Minix file system */ + /* Block size = 1024 bytes. */ + +/* Some maximum sizes */ + +#define MINIX_NAME_MAX 14 /* Max size of a file name */ +#define MINIX_LINK_MAX 127 /* Max links of a file */ +#define MINIX_PATH_MAX 255 /* Maximum path length */ +#define MINIX_PIPE_BUF 512 /* Maximum size of atomic pipe writes */ + +/* Block size defines */ + +#define NO_BLOCK 0 /* Flag indicating no block available */ +#define NO_ZONE 0 /* Flag indicating no zone available */ +#define BLOCK_SIZE 1024 /* # bytes in a disk block */ +#define BITCHUNK_SIZE 2 /* # bytes in a bitchunk */ +#define BITMAP_CHUNKS 512 /* # bitmap chunks in a disk block */ +#define BITCHUNK_BITS 16 /* # bits in a bitchunk */ +#define BITS_PER_BLOCK 8192 /* # bits in a block 8*BLOCK_SIZE */ +#define BITMAPSHIFT 13 /* log2(BITS_PER_BLOCK) */ + +/* Inode defines */ + +#define ROOT_INO 1 /* Minix uses inode 1 for the root inode */ +#define NO_INODE 0 /* Inode number to return if none found */ +#define V2_INODE_SIZE 64 /* size of inode in bytes */ +#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE) /* # of inodes per block */ +#define INODE_MAP 2 /* position of first inode bitmap in file */ +#define V2_NR_DBLOCKS 7 /* # of direct block pointers in inode */ +#define V2_NR_TBLOCKS 10 /* # of block pointers: direct+single+double+triple */ +#define V2_NR_INDIRECTS 256 /* # of indirect pointers in a block */ +#define INDIRECT_SHIFT 8 /* log2(V2_NR_INDIRECTS) */ + +/* These next defines count the number of addressable blocks */ + +#define NR_DIRECT V2_NR_DBLOCKS +#define NR_SINDIRECT V2_NR_INDIRECTS +#define NR_DINDIRECT (V2_NR_INDIRECTS*NR_SINDIRECT) +#define NR_TINDIRECT (V2_NR_INDIRECTS*NR_DINDIRECT) + +#define TOT_DIRECT NR_DIRECT +#define TOT_SINDIRECT (TOT_DIRECT + NR_SINDIRECT) +#define TOT_DINDIRECT (TOT_SINDIRECT + NR_DINDIRECT) +#define TOT_TINDIRECT (TOT_DINDIRECT + NR_TINDIRECT) + +/* Minix flag bits for i_mode in the dinode. */ + +#define I_TYPE 0170000 /* this field gives inode type */ +#define I_SOCK 0140000 /* UNIX domain socket */ +#define I_LINK 0120000 /* symbolic link */ +#define I_REGULAR 0100000 /* regular file, not dir or special */ +#define I_BLOCK_SPECIAL 0060000 /* block special file */ +#define I_DIRECTORY 0040000 /* file is a directory */ +#define I_CHAR_SPECIAL 0020000 /* character special file */ +#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */ +#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */ +#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */ +#define ALL_MODES 0006777 /* all bits for user, group and others */ +#define RWX_MODES 0000777 /* mode bits for RWX only */ +#define R_BIT 0000004 /* Rwx protection bit */ +#define W_BIT 0000002 /* rWx protection bit */ +#define X_BIT 0000001 /* rwX protection bit */ +#define I_NOT_ALLOC 0000000 /* this inode is free */ + +/* Block defines */ + +#define V2_BLOCK_NUM_SIZE 4 /* size of block address in bytes */ +#define V2_INDIRECTS (BLOCK_SIZE/V2_BLOCK_NUM_SIZE) /* # blocks per indir block */ + +/* File system types. (Only SUPER_V2 is recognized in this implementation */ + +#define SUPER_MAGIC 0x137F /* magic number contained in super-block */ +#define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */ +#define SUPER_V2 0x2468 /* magic # for V2 file systems */ +#define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */ + +/* The type of sizeof may be (unsigned) long. Use the following macro for + * taking the sizes of small objects so that there are no surprises like + * (small) long constants being passed to routines expecting an int. + */ + +#define usizeof(t) ((unsigned) sizeof(t)) + +/* Types used in disk, inode, etc. data structures. */ + +typedef u_int16_t mino_t; /* Minix i-node number is 16 bits */ +typedef u_int32_t block_t; /* block number */ +typedef u_int32_t bit_t; /* bit number in a bitmap */ +typedef u_int16_t bitchunk_t; /* a collection of bits from a bitmap */ +typedef long mtime_t; /* time in sec since 1 Jan 1970 0000 GMT */ + +/* Directory layout (Minix only allows 14 characters in a file name) */ + +struct minix_direct { + u_int16_t d_ino; /* 2 */ + char d_name[MINIX_NAME_MAX]; /* 14 */ +}; + +struct minix_dirtemplate { /* 32 bytes */ + u_int16_t dot_ino; + char dot_name[MINIX_NAME_MAX]; + u_int16_t dotdot_ino; + char dotdot_name[MINIX_NAME_MAX]; +}; + +#define DIR_ENTRY_SIZE usizeof(struct minix_direct) /* size of dir entry in bytes = 16 */ +#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /* # of dirs/block = 64 */ +#define MAX_DIR_ENTRIES ((V2_NR_DBLOCKS + V2_NR_INDIRECTS) * NR_DIR_ENTRIES) + +#define MINIX_LINK_MAX 127 /* Maximum number of file links */ +#define MINIX_MAXSYMLINKLEN (4*V2_NR_TBLOCKS) /* Max chars in a short symlink */ +#define MINIX_MAXSYMLINK BLOCK_SIZE /* Max chars in a long symlink */ + +/* Structure of an inode on disk. length = 64 bytes. */ + +struct minix_dinode { + u_int16_t i_mode; /* file type, protection, etc. 2b */ + int16_t i_nlinks; /* how many links to this file 2b */ + int16_t i_uid; /* user id of the file's owner 2b */ + int16_t i_gid; /* group number 2b */ + u_int32_t i_size; /* current file size in bytes 4b */ + int32_t i_atime; /* time of last access (V2 only) 4b */ + int32_t i_mtime; /* when was file data last changed 4b */ + int32_t i_ctime; /* when was inode itself changed (V2 only) 4b */ + u_int32_t i_block[V2_NR_TBLOCKS]; /* direct,+ 1,2,3 indirect 40b */ +}; + +/* Structure of an in-core inode. */ + +struct minix_inode { + struct lock i_lock; /* Inode lock. Must be first. */ + LIST_ENTRY(minix_inode) i_hash; /* Hash chain */ + struct minixmount *i_mmp; + struct vnode *i_vnode; /* Vnode associated with this inode */ + mode_t i_mode; /* BSD style mode of file */ + u_int32_t i_flag; /* flags */ + u_int32_t i_blocks; /* Total number of blocks in file */ + dev_t i_dev; /* specinfo for device associated with this inode */ + ino_t i_number; /* The identity of this inode */ + ino_t i_parent; /* The parent inode */ + int i_count; /* Reference count */ + int i_entry; /* Directory entry number from namei */ + int i_noent; /* First no entry number if a directory */ + struct minix_super_block *i_su; /* Super block */ + struct minix_dinode i_dino; /* The on-disk inode */ +}; + +/* Some useful defines */ + +#define i_nlink i_dino.i_nlinks +#define i_zone i_dino.i_block +#define i_shortlink i_dino.i_block +#define i_rdev i_dino.i_block[0] + +#define ino_to_byte(fs,ino) ((fs->s_firstinode + (ino-1)/V2_INODES_PER_BLOCK)*BLOCK_SIZE) +#define blk_to_byte(blk) ((blk)*BLOCK_SIZE) +#define byte_to_blkn(byte) ((u_daddr_t)((byte) >> DEV_BSHIFT)) +#define ino_off(ino) (((ino-1) % V2_INODES_PER_BLOCK) * V2_INODE_SIZE) +#define VTOMI(vp) ((struct minix_inode*)(vp)->v_data) + +/* These flags are kept in i_flag. (some are not recognized by Minix) */ +#define IN_ACCESS 0x0001 /* Access time update request. */ +#define IN_CHANGE 0x0002 /* Inode change time update request. */ +#define IN_UPDATE 0x0004 /* Modification time update request. */ +#define IN_MODIFIED 0x0008 /* Inode has been modified. */ +#define IN_RENAME 0x0010 /* Inode is being renamed. */ +#define IN_SHLOCK 0x0020 /* File has shared lock. */ +#define IN_EXLOCK 0x0040 /* File has exclusive lock. */ +#define IN_HASHED 0x0080 /* Inode is on hash list */ +#define IN_LAZYMOD 0x0100 /* Modified, but don't write yet. */ + +/* These are the BSD-type mode bits present in the incore inode */ + +/* File permissions. */ +#define IEXEC 0000100 /* Executable. */ +#define IWRITE 0000200 /* Writeable. */ +#define IREAD 0000400 /* Readable. */ +#define ISVTX 0001000 /* Sticky bit. */ +#define ISGID 0002000 /* Set-gid. */ +#define ISUID 0004000 /* Set-uid. */ + +/* File types. */ +#define IFMT 0170000 /* Mask of file type. */ +#define IFIFO 0010000 /* Named pipe (fifo). */ +#define IFCHR 0020000 /* Character device. */ +#define IFDIR 0040000 /* Directory file. */ +#define IFBLK 0060000 /* Block device. */ +#define IFREG 0100000 /* Regular file. */ +#define IFLNK 0120000 /* Symbolic link. */ +#define IFSOCK 0140000 /* UNIX domain socket. */ +#define IFWHT 0160000 /* Whiteout. */ + +#define LSUPER_V2 BLOCK_SIZE /* Byte location of V2 super block on disk */ +#define LSV2BLOCK ((u_daddr_t)(LSUPER_V2/DEV_BSIZE)) /* Record count on device */ + +/* Structure of the superblock length on disk is 24b */ + +struct minix_super_block { + u_short s_ninodes; /* # usable inodes on the minor device 2b */ + u_short s_nzones; /* number of V1 fs zones 2b */ + short s_imap_blocks; /* # of blocks used by inode bit map 2b */ + short s_zmap_blocks; /* # of blocks used by zone bit map 2b */ + u_short s_firstdatazone; /* number of first data zone 2b */ + short s_zshift; /* log2 of blocks/zone 2b */ + u_long s_max_size; /* maximum file size on this device 4b */ + short s_magic; /* magic number 2b */ + short s_pad; /* pad it to a 4-byte boundary 2b */ + u_long s_zones; /* number of V2 fs zones 4b */ + + /* The rest of the structure belongs to the in-core superblock */ + + struct vnode *s_devvp; /* Vnode of device mounted on */ + struct minix_inode *s_root; /* Inode for root dir of mounted file system */ + ino_t s_imnton; /* UFS inode number mounted on */ + u_int16_t *s_ibmap; /* Inode bit-map */ + u_int16_t *s_zbmap; /* Zone bit-map */ + u_int32_t imap_lock; /* Inode bit-map lock variable */ + u_int32_t zmap_lock; /* Zone bit-map lock variable */ + dev_t s_dev; /* Specinfo of device of mounted filesystem */ + int s_rdonly; /* Read only flag */ + int s_version; /* Version number of file system */ + int s_firstinode; /* Block no of first inode */ + int s_zoff; /* Data block offset = s_firstdatazone - 1. */ + int s_bsize; /* Block size */ + int s_zsize; /* Zone size */ +}; + +/* A block can be inodes, directories, a bootblock, a superblock or ... */ + +union minix_block { + struct minix_dinode dinode[16]; /* 16 dinodes */ + struct minix_super_block sp; /* 1 superblock + space */ + struct boot_block_s { /* 1 bootblock + space */ + char bootblock[294]; + char pad[730]; + } boot_block; + struct minix_direct dir[64]; /* 64 directories */ + u_int32_t ind[256]; /* 256 indirect blocks */ + u_int16_t bitchunk[512]; /* 512 bitchunks */ + u_int8_t data[1024]; /* 1024 bytes */ +}; + +#define MBLOCK(bp) ((union minix_block*)((bp)->b_data)) + +struct minixmount { + struct minix_super_block *mnx_su; /* Superblock */ + struct mount *mnx_mp; /* VFS mount structure */ + struct vnode *mnx_devvp; /* Device vnode mounted on */ + dev_t mnx_dev; /* Specinfo of device */ + struct malloc_type *mnx_malloctype; +}; + +/* Inode hash routines */ + +void minix_ihashinit(void); +void minix_ihashuninit(void); +struct vnode *minix_ihashlookup(dev_t, ino_t); +struct vnode *minix_ihashget(dev_t, ino_t); +void minix_ihashins(struct minix_inode *); +void minix_ihashrem(struct minix_inode *); + +/* Support routine prototypes */ + +int minix_vinit(struct mount*, vop_t**, vop_t**, struct vnode**); +int minix_vget(struct mount*, ino_t, struct vnode**); +int minix_vfree(struct vnode*, ino_t, int); +int minix_getblk(struct vnode*,block_t,struct buf**); +int minix_putblk(struct buf*); +void minix_freeblk(struct buf*); +int minix_valloc(struct vnode*,int,struct ucred*, struct vnode**); +int minix_balloc(struct vnode*,u_daddr_t,struct buf**); +int minix_blkatoff(struct vnode*,off_t,char**,struct buf**); +int minix_zalloc(struct minix_super_block*,u_daddr_t*,u_daddr_t*); +int minix_dzalloc(struct minix_super_block*,u_daddr_t); +int minix_makeinode(int,struct vnode*,struct vnode**,struct componentname*); +int minix_addzone(struct minix_inode*,u_daddr_t,u_daddr_t); +int minix_ialloc(struct minix_super_block*,int*); +int minix_dialloc(struct minix_super_block*,int); +int minix_update(struct vnode*); +void minix_itimes(struct vnode*); +int minix_truncate(struct vnode*,off_t,int,struct ucred*,struct proc*); +int minix_iget(struct vnode*,struct minix_super_block*, + mino_t,struct minix_inode*); +int minix_iput(struct minix_inode*); +void minix_wipe_dinode(struct minix_dinode*); +int minix_dinode_access(struct minix_dinode*,int, + struct ucred*,struct minix_super_block*); +int minix_free_inode_count(struct minix_super_block*); +int minix_free_zone_count(struct minix_super_block*); +int minix_next_free_inode(struct minix_super_block*); +int minix_next_free_zone(struct minix_super_block*); +int minix_bmapfs(struct vnode*,u_daddr_t,u_daddr_t*,int*); +int minix_get_vtype(struct minix_inode*); +int minix_num_blocks(u_int16_t, u_int32_t, short); +void minix_get_lock(u_int32_t*); +void minix_free_lock(u_int32_t*); +void minix_makedirentry(struct minix_inode*,struct componentname*, + struct minix_direct*); +int minix_direnter(struct vnode*,struct vnode*,struct minix_direct*, + struct componentname*); +int minix_dirremove(struct vnode*); +int minix_dirempty(struct minix_inode*,ino_t,struct ucred*); +int minix_dirrewrite(struct minix_inode*,struct minix_inode*,ino_t,int); +int minix_checkpath(struct minix_inode*,struct minix_inode*,struct ucred*); + +/* VOP pointers */ + +extern vop_t **minix_vnodeop_p; +extern vop_t **minix_specop_p; +extern vop_t **minix_fifoop_p; + +/* Misc declarations */ + +MALLOC_DECLARE(M_MINIXMNT); +MALLOC_DECLARE(M_MINIXNOD); diff -ruN sys.orig/fs/minixfs/minix_alock.s sys/fs/minixfs/minix_alock.s --- sys.orig/fs/minixfs/minix_alock.s Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_alock.s Fri Feb 28 13:46:38 2003 @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + /************************************************************* + * * + * OK so we have another TSL lock routine. * + * * + * C-Prototype: (long) _alock(long*); * + * * + * I am not spin waiting here because I want the choice * + * of either spin waiting or giving up the processor. * + * This we can do by putting the call to this routine * + * in the argument of a while loop. The loop can either * + * spin or call a cpu giveup routine until the lock is * + * obtained: * + * while (_minix_alock(&lock_var)) { * + * tsleep(&loc_var); * + * } * + * * + * See the file: minix_locks.c, for the implementation. * + * * + *************************************************************/ + +.globl _minix_alock +.align 16 +_minix_alock: + pushl %ebp + movl %esp, %ebp + + pushl %ecx + + movl 8(%ebp), %ecx + movl $1, %eax + + lock xchg (%ecx), %eax + + popl %ecx + + popl %ebp + ret diff -ruN sys.orig/fs/minixfs/minix_bio.c sys/fs/minixfs/minix_bio.c --- sys.orig/fs/minixfs/minix_bio.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_bio.c Fri Feb 28 21:27:15 2003 @@ -0,0 +1,732 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_read_zbit(struct minix_super_block*,u_int32_t); +void minix_write_zbit(struct minix_super_block*,u_int32_t); +void minix_delete_zbit(struct minix_super_block*,u_int32_t); + +/* + * Allocate new blocks from lbof0+1 to lbof1. + * If lbof0 doesn't exist, then allocate it first. + */ +int +minix_balloc(struct vnode *vp, u_daddr_t lbof1, struct buf **bpp) +{ + struct buf *bp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lbof0, lbn, pbn, lb, zone, boff, z0, z1, bsize; + int error; + + *bpp = NULL; + + if (dip->i_size == 0) { /* No zones so create a new one */ + zone = 0; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) + return error; + if ((error = bread(devvp, pbn, sp->s_zsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)sp->s_zsize); + bwrite(bp); + } + + if (dip->i_size > 0) + lbof0 = (dip->i_size - 1)/BLOCK_SIZE; + else + lbof0 = 0; + + z0 = lbof0 >> sp->s_zshift; + z1 = lbof1 >> sp->s_zshift; + + if (z1 <= z0) { /* Zone already exists! just return the block */ + if ((error = minix_bmapfs(vp, lbof1, &pbn, NULL)) != 0) + return error; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)BLOCK_SIZE); + *bpp = bp; + return 0; + } + + /* The new zone extends beyond the file */ + + /* Allocate all the blocks between lbof0 and lbof1 and zero them out */ + + for (lb=lbof0+1; lb> sp->s_zshift; + boff = lb - (zone << sp->s_zshift); + if (boff > 0) { /* Zone already exixts */ + bsize = BLOCK_SIZE; + if ((error = minix_bmapfs(vp, lb, &pbn, NULL)) != 0) + return error; + } else { + bsize = sp->s_zsize; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) /* add the new zone to inode */ + return error; + } + if ((error = bread(devvp, pbn, bsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)bsize); + bwrite(bp); + } + /* Finally allocate lbof1, the required new block */ + + zone = lbof1 >> sp->s_zshift; + boff = lbof1 - (zone << sp->s_zshift); + if (boff > 0) { /* Zone already exists, just get the block */ + bsize = BLOCK_SIZE; + if ((error = minix_bmapfs(vp, lbof1, &pbn, NULL)) != 0) + return error; + } else { + bsize = sp->s_zsize; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) /* add the new zone to inode */ + return error; + } + if ((error = bread(devvp, pbn, bsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)bsize); + + *bpp = bp; + return 0; + +} +/* + * Returns the block number of the next free zone and sets + * the corresponding bit in the zone bitmap. + */ +int +minix_zalloc(struct minix_super_block *sp, u_daddr_t *lblkp, u_daddr_t *pblkp) +{ + int ic, error; + u_daddr_t zone, bblk; + daddr_t off; + struct buf *bp; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + u_daddr_t pbn = 0, pzn = 0; + u_int16_t *buf = sp->s_zbmap; + + *lblkp = 0; + *pblkp = 0; + + minix_get_lock(&sp->zmap_lock); + + if ((zone = minix_next_free_zone(sp)) == NO_ZONE) { + minix_free_lock(&sp->zmap_lock); + return ENOSPC; + } + + minix_write_zbit(sp, zone); + + ic = zone >> 4; /* Chunk that bit resides in */ + bblk = zone / BITS_PER_BLOCK; /* Block that bit is in */ + off = zone % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + bblk += 2 + sp->s_imap_blocks; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp, bblk, &bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_delete_zbit(sp, zone); + minix_free_lock(&sp->zmap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_delete_zbit(sp, zone); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->zmap_lock); + return error; + } + + minix_free_lock(&sp->zmap_lock); + + pzn = zone + sp->s_zoff; /* Physical zone number */ + pbn = pzn << sp->s_zshift; /* Physical block number */ + + *lblkp = pbn; + *pblkp = byte_to_blkn(blk_to_byte(pbn)); /* Suitable for bread */ + + return 0; +} +/* + * Deallocates a zone if the last block in it is released. + */ +int +minix_dzalloc(struct minix_super_block *sp, u_daddr_t zone) +{ + int ic, error; + u_daddr_t bblk; + daddr_t off; + struct buf *bp; + struct vnode *devvp = sp->s_devvp; + u_int16_t *buf = sp->s_zbmap; + union minix_block *mbp; + + minix_get_lock(&sp->zmap_lock); + + zone -= sp->s_zoff; /* Convert to bit offset */ + + if (minix_read_zbit(sp, zone)) + minix_delete_zbit(sp, zone); + else { + minix_free_lock(&sp->zmap_lock); + return 0; + } + + ic = zone >> 4; /* Chunk that bit resides in */ + bblk = zone / BITS_PER_BLOCK; /* Block that bit is in */ + off = zone % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + bblk += 2 + sp->s_imap_blocks; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp, bblk, &bp)) != 0) { + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_write_zbit(sp, zone); + minix_free_lock(&sp->zmap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_write_zbit(sp, zone); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->zmap_lock); + return error; + } + + minix_free_lock(&sp->zmap_lock); + + return 0; +} +/* + * Add a zone to the end of a file. "zone" is the logical zone + * offset in the file and pbn is the physical zone offset in the + * file system. It is the responsibility of the calling + * routine to guarantee that the next zone to add is at the + * logical end of the file. This routine returns EIO otherwise. + */ +int +minix_addzone(struct minix_inode *ip, u_daddr_t zone, u_daddr_t pbn) +{ + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + struct buf *bp; + u_daddr_t pind; + u_daddr_t id0, id1, id2, id3, off, blk; + int error, indirect = 0; + + pind = zone + 1; + + if (pind > TOT_DIRECT) + indirect++; + if (pind > TOT_SINDIRECT) + indirect++; + if (pind > TOT_DINDIRECT) + indirect++; + if (pind > TOT_TINDIRECT) + indirect++; + + switch (indirect) { + case 0: + if (dip->i_block[zone] != 0) + return EIO; + dip->i_block[zone] = pbn; + break; + case 3: + off = zone - TOT_DINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id3 = id2 >> INDIRECT_SHIFT; + id2 = id2 % V2_NR_INDIRECTS; + id1 = off % V2_NR_INDIRECTS; + if (dip->i_block[V2_NR_DBLOCKS+2] == 0) { + /* Generate a triple indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + id0 = blk >> sp->s_zshift; + dip->i_block[V2_NR_DBLOCKS+2] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS+2]; + + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + id0 = mbp->ind[id3]; + if (id0 == 0) { + /* Generate a double indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + mbp->ind[id3] = id0; + bwrite(bp); + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + bwrite(bp); + } else + bqrelse(bp); + goto rind2; + break; + case 2: + off = zone - TOT_SINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id1 = off % V2_NR_INDIRECTS; + if (dip->i_block[V2_NR_DBLOCKS+1] == 0) { + /* Generate double indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + id0 = blk >> sp->s_zshift; + dip->i_block[V2_NR_DBLOCKS+1] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + rind2: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + if (id0 == 0) { + /* Generate a single indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + mbp->ind[id2] = id0; + bwrite(bp); + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + bwrite(bp); + } else + bqrelse(bp); + goto rind1; + break; + case 1: + id1 = zone - TOT_DIRECT; + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + /* Generate a single indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + dip->i_block[V2_NR_DBLOCKS] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS]; + rind1: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->ind[id1] = pbn; + bwrite(bp); + break; + default: + printf("minix_addzone: too large: zone = %d\n",(int)zone); + return ENOSPC; + } + + ip->i_flag |= IN_CHANGE | IN_UPDATE; + + return 0; +} +/* + * bmap returns the buffer block offset given the logical block offset. + * The offset returned is converted to buffer block units with DEV_BSHIFT. + */ +int +minix_bmapfs(struct vnode *vp, /* vnode of file */ + u_daddr_t lbk, /* logical block number */ + u_daddr_t *pbk, /* returned physical block number */ + int *runp) /* number of dev chunks to add */ +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + struct buf *bp; + + int ndb = TOT_DIRECT; + int nsidb = TOT_SINDIRECT; + int ndidb = TOT_DINDIRECT; + int ntidb = TOT_TINDIRECT; + + int ndbpb; + u_daddr_t id, idp, id0=0, id1, id2, id3, blk; + daddr_t offset; + int error, indirect = 0; + + if (runp != NULL) { + ndbpb = BLOCK_SIZE >> DEV_BSHIFT; /* buffer blocks per minix block */ + if (ndbpb > 0) + *runp = ndbpb - 1; + else + *runp = 0; + } + + id = lbk >> sp->s_zshift; /* index by zones */ + offset = lbk - (id << sp->s_zshift); /* Block offset in zone */ + + idp = id + 1; + + if (idp > ndb) + indirect++; + if (idp > nsidb) + indirect++; + if (idp > ndidb) + indirect++; + if (idp > ntidb) + indirect++; + + *pbk = 0; + switch (indirect) { + case 0: /* Direct */ + if ((*pbk = (dip->i_block[id] << sp->s_zshift)) == 0) + return EFAULT; + *pbk += offset; + *pbk = ((*pbk)*BLOCK_SIZE) >> DEV_BSHIFT; + return 0; + case 3: /* Triple indirect */ + if ((blk = (dip->i_block[V2_NR_DBLOCKS+2] << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + brelse(bp); + return error; + } + mbp = MBLOCK(bp); + id -= ndidb; + id3 = (id >> INDIRECT_SHIFT) >> INDIRECT_SHIFT; + id2 = (id >> INDIRECT_SHIFT) % V2_NR_INDIRECTS; + id1 = id % V2_NR_INDIRECTS; + id0 = mbp->ind[id3]; + bqrelse(bp); + goto rind2; + case 2: /* Double indirect */ + id -= nsidb; + id2 = id >> INDIRECT_SHIFT; + id1 = id % V2_NR_INDIRECTS; + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + rind2: + if ((blk = (id0 << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + brelse(bp); + return error; + } + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + bqrelse(bp); + goto rind1; + case 1: /* Single indirect */ + id1 = id - ndb; + id0 = dip->i_block[V2_NR_DBLOCKS]; + rind1: + if ((blk = (id0 << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + if ((*pbk = (mbp->ind[id1] << sp->s_zshift)) == 0) { + brelse(bp); + return EFAULT; + } + bqrelse(bp); + *pbk += offset; + *pbk = ((*pbk)*BLOCK_SIZE) >> DEV_BSHIFT; + return 0; + default: + return ENOSPC; + } + + /* NOTREACHED */ +} +/* + * Returns a logical block in a buffer + */ +int +minix_getblk(struct vnode *devvp, block_t blk, struct buf **bpp) +{ + u_daddr_t offset; + int error; + + offset = (u_daddr_t)byte_to_blkn(blk_to_byte(blk)); + if ((error = bread(devvp, offset, BLOCK_SIZE, NOCRED, bpp)) != 0) + return error; + return 0; +} +/* + * Writes the buffer to disk + */ +int +minix_putblk(struct buf *bp) +{ + bp->b_flags &= ~B_ASYNC; + return bwrite(bp); +} +/* + * Releases the buffer block from any connection with the minixfs + */ +void +minix_freeblk(struct buf *bp) { + bp->b_flags |= B_FREEBUF; + brelse(bp); +} +/* + * Return buffer with the contents of block "offset" from the beginning of + * directory "ip". If "res" is non-zero, fill it in with a pointer to the + * remaining space in the directory. + */ +int +minix_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) +{ + struct buf *bp; + u_daddr_t lbn, pbn; + struct minix_inode *ip = VTOMI(vp); + struct vnode *devvp = ip->i_su->s_devvp; + int error; + + lbn = ((u_daddr_t)offset) / BLOCK_SIZE; + + if ((error = minix_bmapfs(vp, lbn, &pbn, (int*)NULL)) != 0) + return error; + + *bpp = NULL; + bp = NULL; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + if (res != NULL) + *res = (char *)bp->b_data + (int)(offset % BLOCK_SIZE); + *bpp = bp; + return 0; +} +/* + * The next few routines read or alter the in-core + * zone bitmaps. Any locking that is required is + * assumed to occur in the calling programs. + */ + +/* + * Return the number of free zones + */ +int +minix_free_zone_count(struct minix_super_block *sp) +{ + short nbits[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 }; + u_int16_t *bits = sp->s_zbmap; + int b1,b2,b3,b4,j,n; + int sum; + + sum = sp->s_zones - sp->s_firstdatazone + 1; + + n = ((sum-1)>>4) + 1; + for (j=0; j> 12) & 0xf; + b3 = (bits[j] >> 8) & 0xf; + b2 = (bits[j] >> 4) & 0xf; + b1 = bits[j] & 0xf; + sum -= (nbits[b1] + nbits[b2] + + nbits[b3] + nbits[b4]); + } + return(sum < 0 ? 0 : sum+1); /* Add one to counter bit zero in the bitmap */ +} +/* + * Returns the next free zone + */ +int +minix_next_free_zone(struct minix_super_block *sp) +{ + int i, n, s, nb; + u_int16_t *buf = sp->s_zbmap; + register int bit; + + nb = sp->s_zones - sp->s_firstdatazone + 1; + n = nb >> 4; + if ((nb % 16) > 0) + n += 1; + + /* Look for a hole in a chunk, then */ + /* search the chunk for the bit */ + + for (i=0; i> s) & 1)) { + bit = s + (i << 4); + return((bit < nb) ? bit : NO_ZONE); + } + return NO_ZONE; +} +/* + * Read a bit from the in-core data block bitmap + */ +int +minix_read_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + return ((int)((buf[w] >> s) & 0x1)); +} +/* + * Write a bit into the in-core data block bitmap + */ +void +minix_write_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] |= (1 << s); +} +/* + * Delete a bit in the in-core data block bitmap + */ +void +minix_delete_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] &= ~(1 << s); +} +/* + * Figures out the number of data blocks in a file, + * including the indirect blocks, given the size + * of the file. + */ +int +minix_num_blocks(u_int16_t mode, u_int32_t size, short zshift) +{ + int nindirects, indirect = 0; + int nzones, nblocks = 1; + + switch (mode & I_TYPE) { + case I_LINK: + if (size < MINIX_MAXSYMLINKLEN) + return 0; /* No data blocks for a short symlink */ + return 1; /* One data block for a long symlink */ + case I_REGULAR: + break; + default: /* This includes Sock,B_Spec,C_Spec, and Fifo. */ + return 0; + } + if (size == 0) + return 0; + /* + * nblocks set initially to one above. Add the extra blocks below. + */ + nblocks += (size - 1) / BLOCK_SIZE; + nzones = nblocks >> zshift; + if (nblocks > (nzones << zshift)) + nzones += 1; + + /* Figure out whether we have indirect blocks */ + + if (nzones > TOT_DIRECT) + indirect++; /* Single indirect */ + + if (nzones > TOT_SINDIRECT) + indirect++; /* Double indirect */ + + if (nzones > TOT_DINDIRECT) + indirect++; /* Triple indirect */ + + switch (indirect) { + case 0: + return nblocks; + case 1: + return (nblocks + 1); /* One for the indirect */ + case 2: + nindirects = (nblocks - TOT_SINDIRECT - 1)/V2_NR_INDIRECTS; + return (nblocks + nindirects + 2); + case 3: + nindirects = (nblocks - TOT_DINDIRECT - 1) / V2_NR_INDIRECTS; + nindirects += nindirects / V2_NR_INDIRECTS; /* Number of extra doubles */ + return (nblocks + nindirects + V2_NR_INDIRECTS + 2); + default: + break; + } + return 0; /* NOTREACHED */ +} diff -ruN sys.orig/fs/minixfs/minix_ihash.c sys/fs/minixfs/minix_ihash.c --- sys.orig/fs/minixfs/minix_ihash.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_ihash.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,165 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This code was lifted from FreeBSD and modified for Minix. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static MALLOC_DEFINE(M_MNXIHASH, "MINIX ihash", "MINIX Inode hash tables"); +/* + * Structures associated with inode cacheing. + */ +static LIST_HEAD(mnxihashhead, minix_inode) *mnxihashtb; +static u_long minix_ihash; /* size of hash table - 1 */ +#define MNXINOHSH(device, inum) (&mnxihashtb[(minor(device) + (inum)) & minix_ihash]) +#ifndef NULL_SIMPLELOCKS +static struct simplelock minix_ihash_slock; +#endif + +/* + * Initialize inode hash table. + */ +void +minix_ihashinit(void) +{ + mnxihashtb = hashinit(desiredvnodes, M_MNXIHASH, &minix_ihash); + simple_lock_init(&minix_ihash_slock); +} +/* + * Free the inode hash table + */ +void +minix_ihashuninit(void) +{ + if (mnxihashtb) { + free(mnxihashtb, M_MNXIHASH); + mnxihashtb = NULL; + } +} +/* + * Use the device/inum pair to find the incore inode, and return a pointer + * to it. If it is in core, return it, even if it is locked. + */ +struct vnode * +minix_ihashlookup(dev_t dev, ino_t inum) +{ + struct minix_inode *ip; + + simple_lock(&minix_ihash_slock); + for (ip = MNXINOHSH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) + if (inum == ip->i_number && dev == ip->i_dev) + break; + simple_unlock(&minix_ihash_slock); + + if (ip) { + ip->i_vnode->v_type = minix_get_vtype(ip); + return (ip->i_vnode); + } + + return (NULLVP); +} + +/* + * Use the device/inum pair to find the incore inode, and return a pointer + * to it. If it is in core, but locked, wait for it. + */ +struct vnode * +minix_ihashget(dev_t dev, ino_t inum) +{ + struct proc *p = curproc; /* XXX */ + struct minix_inode *ip; + struct vnode *vp; + +loop: + simple_lock(&minix_ihash_slock); + for (ip = MNXINOHSH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) { + if (inum == ip->i_number && dev == ip->i_dev) { + vp = ip->i_vnode; + simple_lock(&vp->v_interlock); + simple_unlock(&minix_ihash_slock); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + goto loop; + vp->v_type = minix_get_vtype(ip); + return (vp); + } + } + simple_unlock(&minix_ihash_slock); + + return (NULLVP); +} + +/* + * Insert the inode into the hash table, and return it locked. + */ +void +minix_ihashins(struct minix_inode *ip) +{ + struct proc *p = curproc; /* XXX */ + struct mnxihashhead *ipp; + + if (1) + return; + + /* lock the inode, then put it on the appropriate hash list */ + lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + + simple_lock(&minix_ihash_slock); + ipp = MNXINOHSH(ip->i_dev, ip->i_number); + LIST_INSERT_HEAD(ipp, ip, i_hash); + ip->i_flag |= IN_HASHED; + simple_unlock(&minix_ihash_slock); +} + +/* + * Remove the inode from the hash table. + */ +void +minix_ihashrem(struct minix_inode *ip) +{ + if (1) + return; + + simple_lock(&minix_ihash_slock); + if (ip->i_flag & IN_HASHED) { + ip->i_flag &= ~IN_HASHED; + LIST_REMOVE(ip, i_hash); +#ifdef DIAGNOSTIC + ip->i_hash.le_next = NULL; + ip->i_hash.le_prev = NULL; +#endif + } + simple_unlock(&minix_ihash_slock); +} diff -ruN sys.orig/fs/minixfs/minix_inode.c sys/fs/minixfs/minix_inode.c --- sys.orig/fs/minixfs/minix_inode.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_inode.c Fri Feb 28 21:21:42 2003 @@ -0,0 +1,757 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_read_ibit(struct minix_super_block*,int); +void minix_write_ibit(struct minix_super_block*,int); +void minix_delete_ibit(struct minix_super_block*,int); +static int minix_truncatefs(struct minix_inode*,u_daddr_t,u_daddr_t); + +int +minix_makeinode(int mode, struct vnode *dvp, + struct vnode **vpp, struct componentname *cnp) +{ + struct minix_inode *dip, *ip; + struct vnode *tvp; + struct minix_direct newdir; + int error; + + dip = VTOMI(dvp); + *vpp = NULL; + + if ((mode & IFMT) == 0) + mode |= IFREG; + + if ((error = minix_valloc(dvp, mode, cnp->cn_cred, &tvp)) != 0) + return error; + + ip = VTOMI(tvp); + ip->i_dino.i_gid = dip->i_dino.i_gid; + + /* + * If we are not the owner of the directory, + * and we are hacking owners here, (only do this where told to) + * and we are not giving it TO root, (would subvert quotas) + * then go ahead and give it to the other user. + * Note that this drops off the execute bits for security. + */ + if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && + (dip->i_dino.i_mode & ISUID) && + (dip->i_dino.i_uid != cnp->cn_cred->cr_uid) && dip->i_dino.i_uid) { + ip->i_dino.i_uid = dip->i_dino.i_uid; + mode &= ~07111; + } else + ip->i_dino.i_uid = cnp->cn_cred->cr_uid; + + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + ip->i_mode = mode; + ip->i_dino.i_mode = mode; + tvp->v_type = minix_get_vtype(ip); /* Rest init'd in getnewvnode(). */ + ip->i_nlink = 1; + + if ((ip->i_mode & ISGID) && !groupmember(ip->i_dino.i_gid, cnp->cn_cred) && + suser_xxx(cnp->cn_cred, 0, 0)) + ip->i_mode &= ~ISGID; + /* + * Make sure inode goes to disk before directory entry. + */ + if ((error = minix_update(tvp)) != 0) + goto bad; + + minix_makedirentry(ip, cnp, &newdir); + + if ((error = minix_direnter(dvp, tvp, &newdir, cnp)) != 0) + goto bad; + + *vpp = tvp; + + return 0; +bad: + /* + * Write error occurred trying to update the inode + * or the directory so must deallocate the inode. + */ + ip->i_nlink = 0; + ip->i_flag |= IN_CHANGE; + vput(tvp); + return error; +} +/* + * Truncate the inode to at most length size, freeing the + * disk blocks. + */ +int +minix_truncate(struct vnode *vp, + off_t length, + int flags, + struct ucred *cred, + struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + u_daddr_t lbn0, lbn1, len32; + int error; + + if (length > ~(1 << 31)) /* 32-bit offsets only! */ + return EFBIG; + + len32 = (u_daddr_t)length; + + /* Data in a short symlink is stored in the inode */ + + if (vp->v_type == VLNK && + dip->i_size < vp->v_mount->mnt_maxsymlinklen) { + bzero((char*)ip->i_shortlink, MINIX_MAXSYMLINKLEN); + dip->i_size = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(vp); + } + if (dip->i_size <= len32) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(vp); + } + + /* lbn1 is the last zone in the file */ + + lbn1 = (dip->i_size - 1)/sp->s_zsize; + + /* lbn0 is the first zone to eliminate */ + + if (len32 > 0) + lbn0 = (len32 - 1)/sp->s_zsize + 1; + else + lbn0 = 0; /* Eliminate all zones */ + + if (lbn0 > lbn1) /* Silly but check anyway */ + return EIO; + + /* truncatefs will eliminate all zones from lbn0 to EOF */ + + if ((error = minix_truncatefs(ip, lbn0, len32)) != 0) + return error; + + dip->i_size = len32; /* The new length of the file */ + ip->i_blocks = minix_num_blocks(ip->i_mode, len32, sp->s_zshift); + + ip->i_flag |= IN_CHANGE | IN_UPDATE; + + return minix_update(vp); +} +/* + * Frees all zones from the logical offset lbn to the end of the file. + */ +static int +minix_truncatefs(struct minix_inode *ip, u_daddr_t lbn, u_daddr_t length) +{ + struct buf *bp; + union minix_block *mbp; + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lb0, lb, off = 0; + u_daddr_t blk, id0, id1, id2, id3, zone; + int error, indirect; + int delete1, delete2, delete3; + + if (dip->i_size == 0) + return 0; + + lb = lb0 = (dip->i_size - 1)/sp->s_zsize; + + if (lb < lbn) + return EIO; + + do { + delete1 = 0; + delete2 = 0; + delete3 = 0; + indirect = 0; + if (lb >= TOT_DIRECT) + indirect++; + if (lb >= TOT_SINDIRECT) + indirect++; + if (lb >= TOT_DINDIRECT) + indirect++; + if (lb >= TOT_TINDIRECT) + indirect++; + + switch (indirect) { + case 0: + if ((error = minix_dzalloc(sp, dip->i_block[lb])) != 0) + return error; + dip->i_block[lb] = 0; + break; + case 3: + off = lb - TOT_DINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id3 = id2 >> INDIRECT_SHIFT; + id2 = id2 % V2_NR_INDIRECTS; + id1 = off % V2_NR_INDIRECTS; + if (id1 == 0) { + delete1 = 1; + if (id2 == 0) { + delete2 = 1; + if (id3 == 0) + delete3 = 1; + } + } + blk = dip->i_block[V2_NR_DBLOCKS+2] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return 0; + mbp = MBLOCK(bp); + id0 = mbp->ind[id3]; + if (delete3) { + zone = dip->i_block[V2_NR_DBLOCKS+2]; + dip->i_block[V2_NR_DBLOCKS+2] = 0; + if ((error = minix_dzalloc(sp, zone)) != 0) + return error; + brelse(bp); + } else { + if (delete2) { + mbp->ind[id3] = 0; + bwrite(bp); + } else + bqrelse(bp); + } + goto rind2; + case 2: + off = lb - TOT_SINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id1 = off % V2_NR_INDIRECTS; + if (id1 == 0) { + delete1 = 1; + if (id2 == 0) + delete2 = 1; + } + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + if (delete2) + dip->i_block[V2_NR_DBLOCKS+1] = 0; + rind2: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + if (delete2) { + if ((error = minix_dzalloc(sp,id0)) != 0) + return error; + } + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + if (delete2) + brelse(bp); + else { + if (delete1) { + mbp->ind[id2] = 0; + bwrite(bp); + } else + bqrelse(bp); + } + goto rind1; + case 1: + id1 = lb - TOT_DIRECT; + if (id1 == 0) + delete1 = 1; + id0 = dip->i_block[V2_NR_DBLOCKS]; + if (delete1) + dip->i_block[V2_NR_DBLOCKS] = 0; + rind1: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + if ((error = minix_dzalloc(sp, mbp->ind[id1])) != 0) + return error; + if (delete1) { + if ((error = minix_dzalloc(sp, id0)) != 0) + return error; + brelse(bp); + } else { + mbp->ind[id1] = 0; + bwrite(bp); + } + break; + default: + return EIO; + } + + } while (lbn < lb--); + + return 0; +} +/* + * Update the access, modified, and inode change times as specified by the + * IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode + * to disk if the IN_MODIFIED flag is set (it may be set initially, or by + * the timestamp update). + */ +int +minix_update(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + + minix_itimes(vp); + + if ((ip->i_flag & IN_MODIFIED) == 0) + return 0; + + ip->i_flag &= ~(IN_MODIFIED); + + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return 0; + + return minix_iput(ip); +} + +void +minix_itimes(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + struct timespec ts; + + if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0) + return; + + if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { + vfs_timestamp(&ts); + if (ip->i_flag & IN_ACCESS) { + ip->i_dino.i_atime = ts.tv_sec; + } + if (ip->i_flag & IN_UPDATE) { + ip->i_dino.i_mtime = ts.tv_sec; + } + if (ip->i_flag & IN_CHANGE) { + ip->i_dino.i_ctime = ts.tv_sec; + } + ip->i_flag |= IN_MODIFIED; + } + ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); +} +/* + * The following access routine was lifted from the UFS code. + */ +int +minix_dinode_access(struct minix_dinode *dip, int mode, + struct ucred *cred, struct minix_super_block *sp) +{ + int i,mask; + gid_t *gp; + + /* + * Disallow write attempts on read-only file systems; + * unless the file is a socket, fifo, or a block or + * character device resident on the file system. + */ + + if (mode & VWRITE) { + switch ((dip->i_mode) & I_TYPE) { + case I_DIRECTORY: + case I_LINK: + case I_REGULAR: + if (sp->s_rdonly != 0) + return EROFS; + break; + } + } + + /* No immutable bit in minix */ + + /* user id 0 always gets access. */ + + if (cred->cr_uid == 0) + return 0; + + mask = 0; + + /* check the owner. */ + + if (cred->cr_uid == dip->i_uid) { + if (mode & VEXEC) + mask |= S_IXUSR; + if (mode & VREAD) + mask |= S_IRUSR; + if (mode & VWRITE) + mask |= S_IWUSR; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); + } + + /* check the groups. */ + + for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) + if (dip->i_gid == *gp) { + if (mode & VEXEC) + mask |= S_IXGRP; + if (mode & VREAD) + mask |= S_IRGRP; + if (mode & VWRITE) + mask |= S_IWGRP; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); + } + + /* check everyone else. */ + + if (mode & VEXEC) + mask |= S_IXOTH; + if (mode & VREAD) + mask |= S_IROTH; + if (mode & VWRITE) + mask |= S_IWOTH; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); +} + +/* Clean up the inode associated with the vnode before freeing it */ + +/* + * Free an inode; put it back into the block that it belongs + * and then free the block. Update the superblock if necessary. + */ + +int +minix_vfree(struct vnode *vp, ino_t ino, int mode) +{ + struct minix_inode *ip = VTOMI(vp); + + return minix_dialloc(ip->i_su, ino); +} +/* + * Get a minix inode with no vnode attached. Routine + * assumes that space for the inode, pointed to by ip, + * is supplied by the caller. Also notice that there + * is no vnode involved here, so the elements i_vnode + * and i_mmp are set to NULL and i_parent = 0; + */ +int +minix_iget(struct vnode *devvp, struct minix_super_block *sp, + mino_t ino, struct minix_inode *ip) +{ + struct buf *bp; + block_t blk; + union minix_block *mbp; + int error; + u_daddr_t off; + + bzero((caddr_t)ip, sizeof(struct minix_inode)); + blk = (block_t)ino_to_byte(sp,ino)/BLOCK_SIZE; + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + + mbp = MBLOCK(bp); + off = (ino-1) % V2_INODES_PER_BLOCK; + ip->i_dino = mbp->dinode[off]; + + bqrelse(bp); + + ip->i_number = ino; + ip->i_parent = 0; + ip->i_su = sp; + ip->i_vnode = NULL; + ip->i_mode = ip->i_dino.i_mode; + ip->i_mmp = NULL; + ip->i_dev = devvp->v_rdev; + ip->i_flag = 0; + + return 0; +} +/* + * Write an inode; assumes that the caller will + * release the space pointed to by ip when finished. + */ +int +minix_iput(struct minix_inode *ip) +{ + struct vnode *devvp; + struct buf *bp; + union minix_block *mbp; + mino_t ino; + block_t blk; + u_daddr_t off; + int error; + + devvp = ip->i_su->s_devvp; + ino = ip->i_number; + blk = (block_t)ino_to_byte(ip->i_su,ino)/BLOCK_SIZE; + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + + mbp = MBLOCK(bp); + off = (ino-1) % V2_INODES_PER_BLOCK; + mbp->dinode[off] = ip->i_dino; + + return minix_putblk(bp); +} +/* + * Returns the next free inode number, sets the bitmap + * to active, writes the bitmap to disk, and cleans + * the on disk dinode. + */ +int +minix_ialloc(struct minix_super_block *sp, int *inop) +{ + int ino, ic, blk, off, error; + u_int16_t *buf = sp->s_ibmap; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + struct minix_inode in; + union minix_block *mbp; + + *inop = 0; + + minix_get_lock(&sp->imap_lock); + + if ((ino = minix_next_free_inode(sp)) == NO_INODE) { + minix_free_lock(&sp->imap_lock); + printf("minix_next_free_inode: returned zero inode\n"); + return ENOSPC; + } + + minix_write_ibit(sp, ino); + + ic = ino >> 4; /* Chunk that bit resides in */ + blk = ino / BITS_PER_BLOCK; /* Block that bit is in */ + off = ino % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + blk += 2; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_delete_ibit(sp, ino); + minix_free_lock(&sp->imap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_delete_ibit(sp,ino); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->imap_lock); + return error; + } + + if ((error = minix_iget(devvp,sp,ino,&in)) != 0) { + minix_free_lock(&sp->imap_lock); + minix_dialloc(sp, ino); + return error; + } + + minix_wipe_dinode(&(in.i_dino)); + + if ((error = minix_iput(&in)) != 0) { + minix_free_lock(&sp->imap_lock); + minix_dialloc(sp,ino); + return error; + } + + minix_free_lock(&sp->imap_lock); + + *inop = ino; + + return 0; +} +int +minix_dialloc(struct minix_super_block *sp, int ino) +{ + int blk, ic, off, error; + u_int16_t *buf = sp->s_ibmap; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + union minix_block *mbp; + + minix_get_lock(&sp->imap_lock); + + if (minix_read_ibit(sp, ino)) + minix_delete_ibit(sp, ino); + else { + minix_free_lock(&sp->imap_lock); + return 0; + } + + ic = ino >> 4; /* Chunk that bit resides in */ + blk = ino / BITS_PER_BLOCK; /* Block that bit is in */ + off = ino % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + blk += 2; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_write_ibit(sp, ino); + minix_free_lock(&sp->imap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_write_ibit(sp,ino); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->imap_lock); + return error; + } + + minix_free_lock(&sp->imap_lock); + + return 0; +} +/* + * The next few routines manipulate/read the inode bitmaps. + * Any locking that is needed is assumed to occur in the + * calling programs. + */ +/* + * Counts the number of free inodes + */ +int +minix_free_inode_count(struct minix_super_block *sp) +{ + short nbits[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 }; + u_int16_t *bits = sp->s_ibmap; + int b1,b2,b3,b4,j,n; + int sum; + + sum = sp->s_ninodes; + + n = ((sp->s_ninodes-1)>>4); + for (j=0; j> 12) & 0xf; + b3 = (bits[j] >> 8) & 0xf; + b2 = (bits[j] >> 4) & 0xf; + b1 = bits[j] & 0xf; + sum -= (nbits[b1] + nbits[b2] + + nbits[b3] + nbits[b4]); + } + return(sum < 0 ? 0 : sum+1); /* Add one to counter bit zero in the bitmap */ +} +/* + * Return the next free inode from the inode bitmap (very simple) + */ +int +minix_next_free_inode(struct minix_super_block *sp) +{ + int i, n, s; + u_int16_t *buf = sp->s_ibmap; + register int bit; + + n = sp->s_ninodes >> 4; + if ((sp->s_ninodes % 16) > 0) + n += 1; + + /* Look for a hole in a chunk, then */ + /* search the chunk for the bit */ + + for (i=0; i> s) & 1)) { + bit = s + (i << 4); + return((bit < sp->s_ninodes) ? bit : NO_INODE); + } + return NO_INODE; +} +/* + * Read a bit from the in-core inode bitmap + * note log2(16) = 4 + */ +int +minix_read_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + return ((int)((buf[w] >> s) & 0x1)); +} +/* + * Write a bit into the in-core inode bitmap + */ +void +minix_write_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] |= (1 << s); +} +/* + * Delete a bit in the in-core inode bitmap + */ +void +minix_delete_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] &= ~(1 << s); +} + +void +minix_wipe_dinode(struct minix_dinode *dip) +{ + bzero((char*)dip, sizeof(struct minix_dinode)); +} diff -ruN sys.orig/fs/minixfs/minix_locks.c sys/fs/minixfs/minix_locks.c --- sys.orig/fs/minixfs/minix_locks.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_locks.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +u_int32_t _minix_alock(u_int32_t*); + +void +minix_get_lock(u_int32_t *lock) +{ + while(_minix_alock(lock)) + tsleep(lock, PINOD, "Mnxlck", 0); +} + +void +minix_free_lock(u_int32_t *lock) +{ + *lock = 0l; + wakeup(lock); +} diff -ruN sys.orig/fs/minixfs/minix_lookup.c sys/fs/minixfs/minix_lookup.c --- sys.orig/fs/minixfs/minix_lookup.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_lookup.c Fri Feb 28 21:28:31 2003 @@ -0,0 +1,1273 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Much of the code below follows FreeBSD's ufs implementation */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +struct minix_namei_args { + struct vnode *a_devvp; + struct minix_super_block *a_sp; + struct ucred *a_cred; + struct proc *a_pp; +}; + +int minix_lookup(struct vop_cachedlookup_args*); + +static int minix_namei(struct minix_namei_args*,char*,ino_t*,ino_t*,int*); +static int minix_newdirent(struct vnode*); +static int minix_dirsize(struct vnode*, u_long*); +static int minix_dircount(struct vnode*, u_long*); +static int minix_dirmove(struct vnode*, struct minix_direct*, u_long); +static int minix_dirclean(struct vnode*); +static int minix_dircleanup(struct vnode*); +static char *minix_strtok(char*, char*); +static char *minix_strtok_r(char*, char*, char**); + +ino_t root_inode, current_inode; /* For communication with minix_namei(). */ + +int +minix_lookup(struct vop_cachedlookup_args *ap) + /* + struct vop_cachedlookup_args + { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + } *ap; + */ +{ + struct vnode *dvp = ap->a_dvp; + struct vnode **vpp = ap->a_vpp; + struct componentname *cnp = ap->a_cnp; + struct vnode *vp = NULL; + int error, isdot, entry; + u_long flags, islastcn, lockparent, nameiop, wantparent; + struct proc *pp; + struct mount *mp; + struct ucred *cred; + struct minix_inode *dip; /* minix inode for directory being searched */ + struct minix_inode *ip; /* target inode */ + struct minixmount *mmp; /* minix mount information */ + struct minix_super_block *msp; + struct minix_namei_args nia; + ino_t mdino; /* minix initial directory inode number */ + ino_t mino, pino; /* minix target inode number and parent */ + char path[PATH_MAX+1]; + + nameiop = cnp->cn_nameiop; + flags = cnp->cn_flags; + lockparent = flags & LOCKPARENT; + islastcn = flags & ISLASTCN; + wantparent = flags & (LOCKPARENT|WANTPARENT); + + pp = cnp->cn_proc; + cred = pp->p_cred->pc_ucred; + dip = VTOMI(dvp); + mmp = dip->i_mmp; + mp = mmp->mnx_mp; + msp = mmp->mnx_su; + + root_inode = (ino_t)msp->s_root->i_number; + current_inode = (ino_t)dip->i_number; + + mdino = current_inode; + + isdot = ((cnp->cn_namelen) == 1 && (cnp->cn_nameptr[0] == '.')); + + if (mdino == 0) + return ERANGE; + /* + * Check accessibility of directory. + */ + if (dvp->v_type != VDIR) + return ENOTDIR; + + if ((error = VOP_ACCESS(dvp, VEXEC, cred, pp)) != 0) + return error; + + if (islastcn && (dvp->v_mount->mnt_flag & MNT_RDONLY) && + (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == CREATE || + cnp->cn_nameiop == RENAME)) + return EROFS; + + /* + * Search dvp for the component cnp->cn_nameptr. + */ + nia.a_devvp = mmp->mnx_devvp; + nia.a_sp = mmp->mnx_su; + nia.a_cred = cred; + nia.a_pp = pp; + + /* We assume that the pathlength has been checked earlier */ + + bzero(path, PATH_MAX+1); + bcopy(cnp->cn_nameptr, path, cnp->cn_namelen); + + error = minix_namei(&nia, path, &mino, &pino, &entry); + + if (error != 0) { + + if (error != ENOENT) + return error; + + if ((nameiop == CREATE || nameiop == RENAME) + && islastcn && wantparent + && dip->i_dino.i_nlinks != 0) { + /* + * Check for write access on directory. + */ + if((error = VOP_ACCESS(dvp, VWRITE, cred, pp)) != 0) + return error; + /* + * Possibly record the position of a slot in the directory + * large enough for the new component name. This can be + * recorded in the vnode private data for dvp. + * Set the SAVENAME flag to hold onto the pathname for use + * later in VOP_CREATE or VOP_RENAME. + */ + + dip->i_entry = entry; + + cnp->cn_flags |= SAVENAME; + if (!lockparent) + /* + * Note that the extra data recorded above is only + * useful if lockparent is specified. + */ + VOP_UNLOCK(dvp, 0, pp); + + return EJUSTRETURN; + } + + /* + * Consider inserting name into cache. + */ + if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + cache_enter(dvp, NULL, cnp); + + return ENOENT; + } else { + /* + * If deleting, and at end of pathname, return parameters + * which can be used to remove file. If the wantparent flag + * isn't set, we return only the directory, otherwise we go on + * and lock the inode, being careful with ".". + */ + if (nameiop == DELETE && islastcn) { + /* + * Check for write access on directory. + */ + if ((error = VOP_ACCESS(dvp, VWRITE, cred, pp)) != 0) + return error; + + dip->i_entry = entry; + + if (mino == dip->i_number || isdot) { + VREF(dvp); + *vpp = dvp; + return 0; + } + + if ((error = VFS_VGET(dvp->v_mount, mino, &vp)) != 0) + return error; + + ip = VTOMI(vp); + ip->i_parent = pino; /* Record the parent inode */ + +/* Minix does not support the concept of a sticky bit (:<)! + + if (directory is sticky + && cred->cr_uid != 0 + && cred->cr_uid != owner of dvp + && owner of vp != cred->cr_uid) { + vput(vp); + return EPERM; + } +*/ + *vpp = vp; + if (!lockparent) + VOP_UNLOCK(dvp, 0, pp); + + return 0; + } + /* + * If rewriting (RENAME), return the inode and the + * information required to rewrite the present directory + * Must get inode of directory entry to verify it's a + * regular file, or empty directory. + */ + if (nameiop == RENAME && wantparent && islastcn) { + error = VOP_ACCESS(dvp, VWRITE, cred, pp); + if (error) + return (error); + + dip->i_entry = entry; + + /* + * Check for "." + */ + if (mino == dip->i_number || isdot) + return EISDIR; + + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) + return error; + *vpp = vp; + /* + * Save the name for use in VOP_RENAME later. + */ + cnp->cn_flags |= SAVENAME; + if (!lockparent) + VOP_UNLOCK(dvp, 0, pp); + + return 0; + } + + /* + * Step through the translation in the name. We do not `vput' the + * directory because we may need it again if a symbolic link + * is relative to the current directory. Instead we save it + * unlocked as "pdp". We must get the target inode before unlocking + * the directory to insure that the inode will not be removed + * before we get it. We prevent deadlock by always fetching + * inodes from the root, moving down the directory tree. Thus + * when following backward pointers ".." we must unlock the + * parent directory before getting the requested directory. + * There is a potential race condition here if both the current + * and parent directories are removed before the VFS_VGET for the + * inode associated with ".." returns. We hope that this occurs + * infrequently since we cannot avoid this race condition without + * implementing a sophisticated deadlock detection algorithm. + * Note also that this simple deadlock detection scheme will not + * work if the file system has any hard links other than ".." + * that point backwards in the directory structure. + */ + if (flags & ISDOTDOT) { + VOP_UNLOCK(dvp, 0, pp); /* race to get the inode */ + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) { + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, pp); + return (error); + } + if (lockparent && islastcn) { + error = vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, pp); + if (error) { + vput(vp); + return error; + } + } + *vpp = vp; + } else if (mino == dip->i_number || isdot) { + VREF(dvp); /* we want ourself, ie "." */ + *vpp = dvp; + } else { + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) + return (error); + if (!lockparent || !islastcn) + VOP_UNLOCK(dvp, 0, pp); + *vpp = vp; + } + + /* + * Insert name into cache if appropriate. + */ + if (cnp->cn_flags & MAKEENTRY) + cache_enter(dvp, *vpp, cnp); + return (0); + } +} + +/*********************************************************************** + * * + * namei() parses the directory path and returns the inode number * + * of the last token in the path. If there is no path then the * + * current inode number is returned. If the path leads to no inode * + * then zero is returned and ENOENT is returned as an error. * + * by Ed Alley 021006 * + * * + ***********************************************************************/ + +static int +minix_namei(struct minix_namei_args *ap, char *path, ino_t *ino, ino_t *pino, int *entp) +{ + struct vnode *devvp = ap->a_devvp; + struct minix_super_block *sp = ap->a_sp; + struct ucred *cred = ap->a_cred; + struct buf *bp; + struct minix_inode *ip, in; + struct minix_dinode *dip; + int i, ib, id, j, error, len, entry = 0; + char ppath[256], *pname; + struct minix_direct dir[NR_DIR_ENTRIES]; + unsigned long ind1[V2_INDIRECTS], blk; + ino_t inum, inuml; + + *ino = 0; + *pino = 0; + *entp = -1; + + if ((len = strlen(path)) > 255) + return ENAMETOOLONG; + + if (path == NULL) { + *ino = current_inode; + return ENOENT; + } + + bzero(ppath, 256); + + if (path[0] == '/') + inum = root_inode; + else + inum = current_inode; + + strncpy(ppath, path, len+1); + + if (ppath[0] == '\0') { + *ino = inum; + return 0; + } + + /* Get the current directory */ + + if ((error = minix_iget(devvp,sp,(mino_t)inum,&in)) != 0) + return error; + + ip = ∈ + dip = &(in.i_dino); /* the dinode of current directory */ + + pname = NULL; + pname = minix_strtok(ppath, "/"); + inuml = inum; + + ip->i_noent = -1; + ip->i_entry = -1; + + while(pname != NULL) { + + ip->i_noent = -1; + ip->i_entry = -1; + + if (!(ip->i_mode & IFDIR)) + return ENOTDIR; + + if (minix_dinode_access(dip,VEXEC,cred,sp) != 0) + return EACCES; + + /* Search directory */ + + entry = 0; + for (i=0; ii_block[i] == 0) { + if (ip->i_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + ib = 1 << sp->s_zshift; + blk = dip->i_block[i] << sp->s_zshift; + while(ib--) { + if((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (j=0; ji_noent < 0) + ip->i_noent = entry; + entry++; + continue; + } + if (!strncmp(pname, dir[j].d_name,MINIX_NAME_MAX)) { + ip->i_entry = entry; + goto gotj; + } + entry++; + } + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + if (ip->i_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + ib = 1 << sp->s_zshift; + blk = ind1[id] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (j=0; ji_noent < 0) + ip->i_noent = entry; + entry++; + continue; + } + if (!strncmp(pname, dir[j].d_name,MINIX_NAME_MAX)) { + ip->i_entry = entry; + goto gotj; + } + entry++; + } + } + } + + /* + * Dropped through: + * Could not find an entry: return "no entry". + */ + + if (ip->i_noent < 0) + ip->i_noent = entry; + + *ino = 0; + *pino = inuml; + *entp = -1; + + return ENOENT; + + gotj: + /* + * Found an entry; get the inode and look for another token. + */ + inuml = inum; + if (!strcmp(dir[j].d_name,"..") && inum == root_inode) + inum = root_inode; + else + inum = dir[j].d_ino; + + if ((error = minix_iget(devvp,sp,(mino_t)inum,ip)) != 0) + return error; + + pname = minix_strtok((char*)NULL, "/"); + } + + /* + * Return the inode for the entry found, and related information. + */ + + *ino = inum; + *pino = inuml; + *entp = entry; + + return 0; +} +/* + * Construct a new directory entry after a call to namei, using the + * parameters that it left in the componentname argument cnp. The + * argument ip is the inode to which the new directory entry will refer. + */ +void +minix_makedirentry(ip, cnp, newdirp) + struct minix_inode *ip; + struct componentname *cnp; + struct minix_direct *newdirp; +{ + int namelen; + bzero(newdirp->d_name, MINIX_NAME_MAX); + + newdirp->d_ino = (short)ip->i_number; + + namelen = strlen(cnp->cn_nameptr); + if (namelen > MINIX_NAME_MAX) + namelen = MINIX_NAME_MAX; + bcopy(cnp->cn_nameptr, newdirp->d_name, namelen); +} +/* + * Write a directory entry after a call to namei, using the parameters + * that it left in nameidata. The argument dirp is the new directory + * entry contents. Dvp is a pointer to the directory to be written, + * which was left locked by namei. Remaining parameter: dp->i_noent + * was left by namei and indicates the entry into the directory list + * where a new entry may be placed. + */ +int +minix_direnter(dvp, tvp, dirp, cnp) + struct vnode *dvp; + struct vnode *tvp; + struct minix_direct *dirp; + struct componentname *cnp; +{ + struct ucred *cr; + struct proc *p; + int newentrysize, newent; + u_int32_t bln, off, newsize; + off_t offset; + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_direct *ep; + struct iovec aiov; + struct uio auio; + struct buf *bp; + char *dirbuf; + int error; + + p = curproc; + cr = p->p_ucred; + + newentrysize = DIR_ENTRY_SIZE; + + if ((error = minix_newdirent(dvp)) != 0) + return error; + if (ip->i_noent < 0 && ip->i_entry < 0) + return ENOSPC; + + if (ip->i_noent < 0 && ip->i_entry >= 0) { /* No Entries Available */ + if (!(ip->i_entry < MAX_DIR_ENTRIES)) + return ENOSPC; + bln = ip->i_entry / NR_DIR_ENTRIES; + auio.uio_offset = bln*BLOCK_SIZE; + auio.uio_resid = newentrysize; + aiov.iov_len = newentrysize; + aiov.iov_base = (caddr_t)dirp; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_rw = UIO_WRITE; + auio.uio_segflg = UIO_SYSSPACE; + auio.uio_procp = (struct proc*)0; + error = VOP_WRITE(dvp, &auio, IO_SYNC, cnp->cn_cred); + ip->i_flag |= IN_CHANGE; + return error; + } + + if (ip->i_noent >= 0) + newent = ip->i_noent; + else + newent = ip->i_entry; + + bln = newent / NR_DIR_ENTRIES; + off = newent % NR_DIR_ENTRIES; + offset = (off_t)(bln*BLOCK_SIZE + off*newentrysize); + + if ((error = minix_blkatoff(dvp, offset, &dirbuf, &bp)) != 0) + return error; + ep = (struct minix_direct*)dirbuf; + *ep = *dirp; + bwrite(bp); + + newsize = (u_int32_t)offset + newentrysize; + if (newsize > dip->i_size) + dip->i_size = newsize; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(dvp); +} +static int +minix_dircleanup(struct vnode *dvp) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + u_daddr_t bln; + u_long newsize; + int error; + + if ((error = minix_dirsize(dvp, &newsize)) != 0) + return error; + + bln = minix_num_blocks(ip->i_mode, (u_int32_t)newsize, sp->s_zshift); + + if (ip->i_blocks > bln) + if ((error = minix_truncate(dvp, (off_t)newsize, IO_SYNC, NOCRED, NULL)) != 0) + return error; + + if (bln > ip->i_blocks) + vnode_pager_setsize(dvp, (vm_ooffset_t)(bln*BLOCK_SIZE)); + + ip->i_blocks = bln; + dip->i_size = newsize; + + return 0; +} +/* + * Removes an entry from a directory. + * NOTE: Will not remove . or .. but returns ENOENT + * in that case. + */ +int +minix_dirremove(struct vnode *dvp) +{ + struct buf *bp; + struct minix_inode *dip = VTOMI(dvp); + struct minix_dinode *dinp = &(dip->i_dino); + union minix_block *mbp; + struct minix_direct *dirp; + struct minix_super_block *sp = dip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t ind, bln, off, dsiz; + u_daddr_t blks, blkc, zone, boff; + u_long count, size; + int entry, error; + + /* + * Entries 0 and 1 are '.' and '..' respectively. + */ + + if ((entry = dip->i_entry) < 2) + return ENOENT; + + bln = entry / NR_DIR_ENTRIES; + off = entry % NR_DIR_ENTRIES; + zone = bln >> sp->s_zshift; + boff = bln - (zone << sp->s_zshift); + + if (zone < V2_NR_DBLOCKS) { + zone = dinp->i_block[zone]; + bln = (zone << sp->s_zshift) + boff; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = 0; + bwrite(bp); + } else { + zone -= V2_NR_DBLOCKS; + bln = dinp->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + ind = mbp->ind[zone]; + bqrelse(bp); + bln = (ind << sp->s_zshift) + boff; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = 0; + bwrite(bp); + } + + if ((error = minix_dirsize(dvp, &size)) != 0) + return error; + if ((error = minix_dircount(dvp, &count)) != 0) + return error; + + blks = size / BLOCK_SIZE; + blkc = count / NR_DIR_ENTRIES; + + if (blkc < blks && count > 2) { + dsiz = BLOCK_SIZE*(blkc+1); + dirp = (struct minix_direct*)malloc(dsiz, M_MINIXNOD, M_WAITOK); + bzero((char*)dirp, dsiz); + if ((error = minix_dirmove(dvp, dirp, count)) != 0) + return error; + if ((error = minix_dirclean(dvp)) != 0) + return error; + for (ind=2; indi_noent. + * Routine returns empty entry number in ip->i_noent + * and zero as the error number. If no entry, because + * the available space is full, then the routine returns + * the next entry number and 0 as an error. + * Finally ENOSPC is returned if we are out of free entries. + * + * Need to improve this by getting an idea of the + * size of the search, so we don't have to search through + * the entire space as we do here. + */ +static int +minix_newdirent(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + struct minix_direct dir[NR_DIR_ENTRIES]; + unsigned long ind1[V2_INDIRECTS]; + u_int32_t blk; + int ib, id, iz, error, entry = 0; + + for (iz=0; izi_block[iz] == 0) { + ip->i_noent = -1; + ip->i_entry = entry; + return 0; + } + blk = dip->i_block[iz] << sp->s_zshift; + ib = 1 << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent = entry; + ip->i_entry = -1; + return 0; + } + entry++; + } + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + ip->i_noent = -1; + ip->i_entry = entry; + return 0; + } + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izi_noent = -1; + ip->i_entry = entry; + return 0; + } + ib = 1 << sp->s_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent = entry; + ip->i_entry = -1; + return 0; + } + entry++; + } + } + } + ip->i_noent = -1; + ip->i_entry = -1; + return ENOSPC; +} + +/* + * The size of a directory corresponds to the index+1 of the + * last entry (including all null entries between) times + * the size of a directory entry in bytes. + */ +static int +minix_dirsize(struct vnode *vp, u_long *last) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + unsigned long ind1[V2_INDIRECTS]; + union minix_block *mbp; + int ib, id, iz, error; + u_int32_t blk; + u_long count = 0; + + *last = count; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + *last = count; + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while (ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + *last = count; + } + bqrelse(bp); + } + } + return 0; +} + +/* + * Count the number of entries in a directory + */ +static int +minix_dircount(struct vnode *dvp, unsigned long *count) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + union minix_block *mbp; + int ib, id, iz, error; + + *count = 0; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + (*count) += 1; + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + (*count) += 1; + } + bqrelse(bp); + } + } + return 0; +} + +static int +minix_dirmove(struct vnode *dvp, struct minix_direct *dirp, unsigned long count) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + unsigned long idc; + union minix_block *mbp; + int ib, id, iz, error; + + if (count < 2) + return EIO; + + idc = 0; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) { + dirp[idc].d_ino = mbp->dir[id].d_ino; + strncpy(dirp[idc].d_name, mbp->dir[id].d_name, MINIX_NAME_MAX); + if (++idc == count) { + bqrelse(bp); + return 0; + } + } + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) { + dirp[idc].d_ino = mbp->dir[id].d_ino; + strncpy(dirp[idc].d_name, mbp->dir[id].d_name, MINIX_NAME_MAX); + if (++idc == count) { + bqrelse(bp); + return 0; + } + } + } + bqrelse(bp); + } + } + return 0; +} +/* + * Clean everything out of a directory except '.' and '..'. + */ +static int +minix_dirclean(struct vnode *dvp) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + union minix_block *mbp; + int ib, ib0, id, iz, error; + + if (dip->i_block[0] == 0) /* This zone must always exist */ + return EIO; + + ip->i_blocks = 1 << sp->s_zshift; + dip->i_size = 2*DIR_ENTRY_SIZE; + + blk = dip->i_block[0] << sp->s_zshift; + ib = ip->i_blocks; + ib0 = ib - 1; + + while(ib--) { + if ((error = minix_getblk(devvp,blk++, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=(ib==ib0)?2:0; iddir[id].d_ino = 0; + bwrite(bp); + } + + for (iz=1; izi_block[iz] == 0) + return 0; + if ((error = minix_dzalloc(sp, dip->i_block[iz])) != 0) + return error; + dip->i_block[iz] = 0; + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + brelse(bp); + + if ((error = minix_dzalloc(sp, dip->i_block[V2_NR_DBLOCKS])) != 0) + return 0; + dip->i_block[V2_NR_DBLOCKS] = 0; + + for (iz=0; izi_dino); + int error, count, namelen; + int mindirsiz = sizeof(struct minix_direct); + + for (off=0; off<(off_t)dip->i_size; off+=mindirsiz) { + error = vn_rdwr(UIO_READ,ip->i_vnode,(caddr_t)dp, + mindirsiz, off, UIO_SYSSPACE, IO_NODELOCKED, + cred, &count, (struct proc*)0); + if (error || count !=0) + return 0; + if (dp->d_ino == 0) + continue; + namelen = strlen(dp->d_name); + if (namelen > 2) + return 0; + if (dp->d_name[0] != '.') + return 0; + if (namelen == 1 && dp->d_ino == ip->i_number) + continue; + if (dp->d_name[1] == '.' && dp->d_ino == parentino) + continue; + return 0; + } + return 1; +} +/* + * Check if source directory is in the path of the target directory. + * Target is supplied locked, source is unlocked. + * The target is always vput before returning. + */ +int +minix_checkpath(struct minix_inode *source, struct minix_inode *target, + struct ucred *cred) +{ + struct vnode *vp; + struct minix_dirtemplate dirbuf; + int error, rootino; + + vp = target->i_vnode; + if (target->i_number == source->i_number) { + error = EEXIST; + goto out; + } + rootino = ROOT_INO; + error = 0; + if (target->i_number == rootino) + goto out; + + /* + * Start at target and move to root, checking as we go. + */ + for (;;) { + if (vp->v_type != VDIR) { + error = ENOTDIR; + break; + } + error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, + sizeof(struct minix_dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED, cred, (int*)0, (struct proc*)0); + if (error != 0) + break; + if (dirbuf.dotdot_name[0] != '.' || + dirbuf.dotdot_name[1] != '.') { + error = ENOTDIR; + break; + } + if (dirbuf.dotdot_ino == source->i_number) { + error = EINVAL; + break; + } + if (dirbuf.dotdot_ino == rootino) /* Check until root */ + break; + vput(vp); + error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp); + if (error) { + vp = NULL; + break; + } + } +out: + if (vp != NULL) + vput(vp); + return error; +} +/* + * Rewrite an existing directory entry to point + * to the inode supplied. NOTE: This only works + * for the first block. + */ +int +minix_dirrewrite(struct minix_inode *dp, struct minix_inode *ip, + ino_t ino, int entry) +{ + struct buf *bp; + union minix_block *mbp; + int off, error; + off_t offset; + u_daddr_t bln; + + bln = entry / NR_DIR_ENTRIES; + off = entry % NR_DIR_ENTRIES; + + offset = (off_t)(bln*BLOCK_SIZE); + + if ((error = minix_blkatoff(dp->i_vnode, offset, NULL, &bp)) != 0) + return error; + + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = ino; + + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + dp->i_flag |= IN_CHANGE | IN_UPDATE; + + return bwrite(bp); +} +/* + * The following was taken from FreeBSD's libc strtok.c and + * slightly modified to use to parse the path in minix_namei(). + */ +static char * +minix_strtok_r(char *s, char *delim, char **last) +{ + char *spanp; + int c, sc; + char *tok; + + if (s == NULL && (s = *last) == NULL) + { + return NULL; + } + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = (char *)delim; (sc = *spanp++) != 0; ) + { + if (c == sc) + { + goto cont; + } + } + + if (c == 0) /* no non-delimiter characters */ + { + *last = NULL; + return NULL; + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) + { + c = *s++; + spanp = (char *)delim; + do + { + if ((sc = *spanp++) == c) + { + if (c == 0) + { + s = NULL; + } + else + { + char *w = s - 1; + *w = '\0'; + } + *last = s; + return tok; + } + } + while (sc != 0); + } + /* NOTREACHED */ +} + +static char * +minix_strtok(char *s, char *delim) +{ + static char *last = NULL; + + return minix_strtok_r(s, delim, &last); +} diff -ruN sys.orig/fs/minixfs/minix_subr.c sys/fs/minixfs/minix_subr.c --- sys.orig/fs/minixfs/minix_subr.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_subr.c Fri Feb 28 21:04:32 2003 @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_to_dirent_type(struct minix_inode*); +int minix_chown(struct vnode*,uid_t,gid_t,struct ucred*,struct proc*); +int minix_chmod(struct vnode*,int,struct ucred*,struct proc*); + +/* + * Allocate a new inode in the file system and + * return its vnode. + */ +int +minix_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) +{ + struct minix_inode *pip = VTOMI(pvp); + struct minix_super_block *sp = pip->i_su; + struct mount *mp = pip->i_mmp->mnx_mp; + struct minix_inode *ip; + struct minix_dinode *dip; + int ino, error; + + if ((error = minix_ialloc(sp, &ino)) != 0) + return error; + + if ((error = minix_vget(mp, ino, vpp)) != 0) { + (void)minix_dialloc(sp, ino); + return error; + } + + ip = VTOMI(*vpp); + ip->i_parent = pip->i_number; + ip->i_count = 1; + ip->i_blocks = 0; + ip->i_mode = mode; + ip->i_flag = IN_MODIFIED; + ip->i_su = sp; + + dip = &(ip->i_dino); + dip->i_mode = mode; /* XXX Check this! */ + dip->i_size = 0; + dip->i_nlinks = 1; + dip->i_uid = cred->cr_uid; + dip->i_gid = pip->i_dino.i_gid; + + (*vpp)->v_type = minix_get_vtype(ip); + + return 0; +} +/* + * Initialize the vnode associated with a new inode, handle aliased + * vnodes. + */ +int +minix_vinit(struct mount *mntp, vop_t **specops, + vop_t **fifoops, struct vnode **vpp) +{ + struct vnode *vp; + struct minix_inode *ip; + struct minix_dinode *dip; + int maj, min; + + vp = *vpp; + ip = VTOMI(vp); + dip = &(ip->i_dino); + + switch(vp->v_type) { + case VCHR: + case VBLK: + vp->v_op = specops; + maj = (dip->i_block[0] >> 8) & 0xff; + min = dip->i_block[0] & 0xff; + addaliasu(vp, dev2udev(makedev(maj,min))); + break; + case VFIFO: + vp->v_op = fifoops; + break; + default: + break; + } + + if (ip->i_number == ROOT_INO) + vp->v_flag |= VROOT; + + *vpp = vp; + + return 0; +} +/* + * Perform chown operation on inode ip; + * inode must be locked prior to call. + * Modified from ufs; PRISON_ROOT is not recognize by + * Minix at this time, so is a no-op. + */ +int +minix_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, + struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + uid_t ouid; + gid_t ogid; + int error = 0; + + if (uid == (uid_t)VNOVAL) + uid = dip->i_uid; + if (gid == (gid_t)VNOVAL) + gid = dip->i_gid; + /* + * If we don't own the file, are trying to change the owner + * of the file, or are not a member of the target group, + * the caller must be superuser or the call fails. + */ + if ((cred->cr_uid != dip->i_uid || uid != dip->i_uid || + (gid != dip->i_gid && !groupmember((gid_t)gid, cred))) && + (error = suser_xxx(cred, p, PRISON_ROOT))) + return (error); + ogid = dip->i_gid; + ouid = dip->i_uid; + + dip->i_gid = gid; + dip->i_uid = uid; + + ip->i_flag |= IN_CHANGE; + if (cred->cr_uid != 0 && (ouid != uid || ogid != gid)) + ip->i_mode &= ~(ISUID | ISGID); + + return 0; +} +/* + * Change the mode on a file. + * Inode must be locked before calling. + * Modified from ufs; there are some options that are + * not recognized by minix at this time: PRISON_ROOT, S_ISTXT. + */ +int +minix_chmod(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + int error; + + if (cred->cr_uid != dip->i_uid) { + error = suser_xxx(cred, p, PRISON_ROOT); + if (error) + return (error); + } + if (cred->cr_uid) { + if (vp->v_type != VDIR && (mode & S_ISTXT)) + return (EFTYPE); + if (!groupmember(dip->i_gid, cred) && (mode & ISGID)) + return (EPERM); + } + ip->i_mode &= ~ALLPERMS; + ip->i_mode |= (mode & ALLPERMS); + dip->i_mode = ip->i_mode; + ip->i_flag |= IN_CHANGE; + return 0; +} + +#include + +int +minix_to_dirent_type(struct minix_inode *ip) +{ + struct minix_dinode *dip = &(ip->i_dino); + int f_type; + + switch(dip->i_mode & I_TYPE) { + case I_NAMED_PIPE: + f_type = DT_FIFO; + break; + case I_CHAR_SPECIAL: + f_type = DT_CHR; + break; + case I_DIRECTORY: + f_type = DT_DIR; + break; + case I_BLOCK_SPECIAL: + f_type = DT_BLK; + break; + case I_REGULAR: + f_type = DT_REG; + break; + case I_LINK: + f_type = DT_LNK; + break; + case I_SOCK: + f_type = DT_SOCK; + break; + default: + f_type = DT_UNKNOWN; + break; + } + + return f_type; +} + +/* Returns ufs vnode type given a minix inode */ + +int +minix_get_vtype(struct minix_inode *ip) +{ + switch (ip->i_mode & I_TYPE) { + case I_DIRECTORY: + return VDIR; + case I_REGULAR: + return VREG; + case I_BLOCK_SPECIAL: + return VBLK; + case I_CHAR_SPECIAL: + return VCHR; + case I_NAMED_PIPE: + return VFIFO; + case I_LINK: + return VLNK; + case I_SOCK: + return VSOCK; + default: + /* + return VNON; + */ + break; + } + return VBAD; +} diff -ruN sys.orig/fs/minixfs/minix_ufs.c sys/fs/minixfs/minix_ufs.c --- sys.orig/fs/minixfs/minix_ufs.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_ufs.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This little bit of code needs to be separate from the rest of + * the Minix code because of name conflicts between minix.h and + * the ufs include files. + */ +#include +#include +#include +#include +#include +#include + +#include +#include + +ino_t ufs_parent_ino(struct mount*); +ino_t ufs_vnode_ino(struct vnode*); + +ino_t +ufs_parent_ino(struct mount *mp) +{ + struct vnode *vp = mp->mnt_vnodecovered; + struct inode *ip = (struct inode*)vp->v_data; + + return (ino_t)ip->i_number; +} + +ino_t +ufs_vnode_ino(struct vnode *vp) +{ + struct inode *ip = (struct inode*)vp->v_data; + + return (ino_t)ip->i_number; +} diff -ruN sys.orig/fs/minixfs/minix_vfsops.c sys/fs/minixfs/minix_vfsops.c --- sys.orig/fs/minixfs/minix_vfsops.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_vfsops.c Fri Feb 28 20:07:19 2003 @@ -0,0 +1,716 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * This file is modelel after both the ufs and ext2fs code. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Various locks used throughout */ + +int minix_inode_hash_lock; + +static int minix_mount(struct mount*, char*, caddr_t, + struct nameidata*, struct proc*); +static int minix_unmount(struct mount*, int, struct proc*); +static int minix_root(struct mount*, struct vnode**); +static int minix_statfs(struct mount*, struct statfs*, struct proc*); +static int minix_sync(struct mount*, int, struct ucred*, struct proc*); +static int minix_start(struct mount*, int, struct proc*); +static int minix_init(struct vfsconf*); +static int minix_uninit(struct vfsconf*); +ino_t ufs_parent_ino(struct mount*); +ino_t ufs_vnode_ino(struct vnode*); + +struct minix_args { + char *fspec; + struct export_args export; +}; + +MALLOC_DEFINE(M_MINIXMNT, "Minixfs mount", "Minixfs mount structure"); +MALLOC_DEFINE(M_MINIXNOD, "Minixfs node", "Minixfs vnode"); + +static int +minix_mount(struct mount *mp, char *path, caddr_t data, + struct nameidata *ndp, struct proc *p) +{ + struct minix_args args; + struct minixmount *mmp = NULL; + struct vnode *devvp, *vproot; + struct buf *bp; + struct minix_super_block *es; + struct ucred *cred = p->p_ucred; + int error = 0, ronly = 0, size; + u_daddr_t iblkn, zblkn; + long isize, ssize, zsize; + mode_t accessmode; + + if (p->p_ucred->cr_uid != 0) + return EACCES; + + if (mp->mnt_flag & MNT_UPDATE) + return EOPNOTSUPP; + + /* no asynchronous updates and no soft updates */ + + mp->mnt_flag &= ~(MNT_ASYNC | MNT_SOFTDEP); + + /*** FORCE READ-ONLY FOR DEBUGGING ***/ +/* + mp->mnt_flag |= MNT_RDONLY; +*/ + /*** FORCE NODEV and NOEXEC for safety ***/ + + mp->mnt_flag |= (MNT_NODEV | MNT_NOEXEC); + + error = copyin(data, (caddr_t)&args, sizeof(struct minix_args)); + if (error) + return error; + + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); + ndp->ni_vp = NULL; + if ((error = namei(ndp)) != 0) + return error; + NDFREE(ndp, NDF_ONLY_PNBUF); + + if (ndp->ni_vp != NULL) + devvp = ndp->ni_vp; + else { + printf("devvp is NULL!\n"); + return ENXIO; + } + + if (!vn_isdisk(devvp, &error)) { + printf("vn_isdisk error = %d\n",error); + goto out; + } + + if (vcount(devvp) < 1) { + printf("devvp: vcount < 1!\n"); + return ENXIO; + } + + /* + * Disallow multiple mounts of the same device. + * Disallow mounting of a device that is currently in use + * (except for root, which might share swap device for miniroot). + * Flush out any old buffers remaining from a previous use. + */ + + if ((error = vfs_mountedon(devvp)) != 0) { + printf("vfs_mountedon error\n"); + goto out; + } + + if (vcount(devvp) > 1 && devvp != rootvp) { + printf("vcount error\n"); + error = EBUSY; + goto out; + } + + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0); + VOP_UNLOCK(devvp, 0, p); + + if (error) { + printf("vinvalbuf error\n"); + goto out; + } + + /* + * If mount by non-root, then verify that the user has + * the necessary permissions on the device. + */ + if (cred->cr_uid != 0) { + accessmode = VREAD; + if ((mp->mnt_flag & MNT_RDONLY) == 0) + accessmode |= VWRITE; + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + if ((error = VOP_ACCESS(devvp, accessmode, cred, p)) != 0) { + vput(devvp); + return (error); + } + VOP_UNLOCK(devvp, 0, p); + } + + /* + * Only VMIO the backing device if the backing device is a real + * block device. This excludes the original MFS implementation. + * Note that it is optional that the backing device be VMIOed. This + * increases the opportunity for metadata caching. + */ + if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + vfs_object_create(devvp, p, p->p_ucred); + simple_lock(&devvp->v_interlock); + VOP_UNLOCK(devvp, LK_INTERLOCK, p); + } + + /*********************************/ + + ronly = (mp->mnt_flag & MNT_RDONLY) != 0; + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); + VOP_UNLOCK(devvp, 0, p); + + if (error) { + printf("VOP_OPEN error\n"); + goto out; + } + + if (devvp->v_rdev->si_iosize_max != 0) + mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; + if (mp->mnt_iosize_max > MAXPHYS) + mp->mnt_iosize_max = MAXPHYS; + + bp = NULL; + if ((error = bread(devvp, LSV2BLOCK, BLOCK_SIZE, NOCRED, &bp)) != 0) { + printf("bread error reading superblock: %d\n",error); + goto out; + } + + es = (struct minix_super_block *)bp->b_data; + + if (es->s_magic != SUPER_V2) { + printf("Invalid super block = 0x%x\n",es->s_magic); + error = EINVAL; + goto out; + } + + if ((mmp = malloc(sizeof(struct minixmount), M_MINIXMNT, M_WAITOK)) == NULL) { + error = ENOMEM; + goto out; + } + bzero(mmp, sizeof(struct minixmount)); + + mp->mnt_data = (qaddr_t)mmp; + + /* The superblock gets stored in mmp */ + + if ((mmp->mnx_su = malloc(sizeof(struct minix_super_block), + M_MINIXMNT, M_WAITOK)) == NULL) { + error = ENOMEM; + goto out; + } + + bcopy(es, mmp->mnx_su, sizeof(struct minix_super_block)); + + brelse(bp); + bp = NULL; + + /* Reset es to point to the stored super block */ + + es = mmp->mnx_su; + + /* Fill the in-core super with stuff */ + + es->s_firstinode = 2 + es->s_imap_blocks + es->s_zmap_blocks; + es->s_zoff = es->s_firstdatazone - 1; + es->s_version = 2; + es->s_dev = devvp->v_rdev; + es->s_devvp = devvp; + es->s_rdonly = ronly; + es->s_bsize = BLOCK_SIZE; + es->s_zsize = BLOCK_SIZE << es->s_zshift; + es->s_imnton = ufs_parent_ino(mp); + es->s_max_size = ((es->s_zones - es->s_zoff) << es->s_zshift)*BLOCK_SIZE; + + isize = blk_to_byte(es->s_imap_blocks); + zsize = blk_to_byte(es->s_zmap_blocks); + iblkn = byte_to_blkn(blk_to_byte(2)); + zblkn = byte_to_blkn(blk_to_byte(es->s_imap_blocks + 2)); + + /* Load the bitmaps into the in-core super */ + + es->s_ibmap = (u_int16_t*)malloc(isize, M_MINIXMNT, M_WAITOK); + if (es->s_ibmap == NULL) { + error = ENOMEM; + goto out; + } + es->s_zbmap = (u_int16_t*)malloc(zsize, M_MINIXMNT, M_WAITOK); + if (es->s_zbmap == NULL) { + error = ENOMEM; + free(es->s_ibmap, M_MINIXMNT); + goto out; + } + bzero(es->s_ibmap, isize); + bzero(es->s_zbmap, zsize); + es->imap_lock = 0l; + es->zmap_lock = 0l; + + if ((error = bread(devvp, iblkn, isize, NOCRED, &bp)) != 0) { + printf("bread error reading inode bitmap\n"); + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((caddr_t)bp->b_data, es->s_ibmap, isize); + brelse(bp); + bp = NULL; + + if ((error = bread(devvp, zblkn, zsize, NOCRED, &bp)) != 0) { + printf("bread error reading block bitmap\n"); + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((caddr_t)bp->b_data, es->s_zbmap, zsize); + brelse(bp); + bp = NULL; + + /* Finish filling mmp */ + + mmp->mnx_devvp = devvp; + mmp->mnx_dev = devvp->v_rdev; + mmp->mnx_mp = mp; + mmp->mnx_malloctype = M_MINIXNOD; + + /* Complete the mount */ + + mp->mnt_stat.f_fsid.val[0] = (long)dev2udev(devvp->v_rdev); + mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; + mp->mnt_maxsymlinklen = MINIX_MAXSYMLINKLEN; /* Max short symlink */ + mp->mnt_flag |= MNT_LOCAL; + + devvp->v_specmountpoint = mp; + + /**************/ + + /* Save "last mounted on" info for mount point (NULL pad)*/ + copyinstr( path, /* mount point*/ + mp->mnt_stat.f_mntonname, /* save area*/ + MNAMELEN - 1, /* max size*/ + &size); /* real size*/ + bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); + + /* Save "mounted from" info for mount point (NULL pad)*/ + copyinstr( args.fspec, /* device name*/ + mp->mnt_stat.f_mntfromname, /* save area*/ + MNAMELEN - 1, /* max size*/ + &size); /* real size*/ + bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + + mp->mnt_stat.f_type = mp->mnt_vfc->vfc_typenum; + mp->mnt_stat.f_owner = p->p_ucred->cr_uid; + mp->mnt_stat.f_flags = mp->mnt_flag; + + minix_statfs(mp, &mp->mnt_stat, p); + + /* minix_root increments usecount as well as locks the vnode */ + + es->s_root = (struct minix_inode*)NULL; + + if ((error = minix_root(mp, &vproot)) != 0) { + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + + ssize = sizeof(struct minix_inode); + + es->s_root = (struct minix_inode*)malloc(ssize, M_MINIXMNT, M_WAITOK); + if (es->s_root == NULL) { + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((char*)vproot->v_data, es->s_root, ssize); + vput(vproot); + + es->s_root->i_parent = es->s_imnton; + + return 0; + +out: + devvp->v_specmountpoint = NULL; + if (bp) + brelse(bp); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, p); + if (vcount(devvp) > 0) + vrele(devvp); + if (mmp) { + if (mmp->mnx_su) + free(mmp->mnx_su, M_MINIXMNT); + free(mmp, M_MINIXMNT); + } + + mp->mnt_data = (qaddr_t)0; + + return error; +} + +static int +minix_unmount(struct mount *mp, int mntflags, struct proc *p) +{ + struct minixmount *mmp = (struct minixmount*)(mp->mnt_data); + struct minix_inode *rip = mmp->mnx_su->s_root; + struct vnode *devvp; + int error, ronly, flags; + + flags = 0; + if (mntflags & MNT_FORCE) + flags |= FORCECLOSE; + + /* Flush all the vnodes associated with mp. */ + + if ((error = vflush(mp, 0, flags)) != 0) + return error; + + cache_purgevfs(mp); + + devvp = mmp->mnx_devvp; + + /* Sync up metadata */ + + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_FSYNC(devvp, p->p_ucred, MNT_WAIT, p); + VOP_UNLOCK(devvp, 0, p); + + minix_ihashrem(rip); + + devvp->v_specmountpoint = NULL; + vinvalbuf(devvp, V_SAVE, NOCRED, p, 0, 0); + ronly =(mp->mnt_flag & MNT_RDONLY) != 0; + error = VOP_CLOSE(devvp,ronly ? FREAD : FREAD|FWRITE,NOCRED,p); + vrele(devvp); + + free(mmp->mnx_su->s_ibmap, M_MINIXMNT); + free(mmp->mnx_su->s_zbmap, M_MINIXMNT); + if (mmp->mnx_su->s_root) + free(mmp->mnx_su->s_root, M_MINIXMNT); + free(mmp->mnx_su, M_MINIXMNT); + free(mmp, M_MINIXMNT); + mp->mnt_data = (qaddr_t)0; + mp->mnt_flag &= ~MNT_LOCAL; + + return error; +} + +static int +minix_root(struct mount *mp, struct vnode **vpp) +{ + return minix_vget(mp, (ino_t)ROOT_INO, vpp); +} + +static int +minix_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) +{ + struct minixmount *mmp; + struct minix_super_block *sp; + size_t size; + + mmp = (struct minixmount*)(mp->mnt_data); + sp = mmp->mnx_su; + + sbp->f_bsize = BLOCK_SIZE; + sbp->f_iosize = BLOCK_SIZE; + sbp->f_blocks = (sp->s_zones - sp->s_zoff) << sp->s_zshift; + sbp->f_bfree = (minix_free_zone_count(sp) << sp->s_zshift); + sbp->f_ffree = minix_free_inode_count(sp); + sbp->f_files = sp->s_ninodes; + sbp->f_bavail = sbp->f_bfree; + copystr("minixfs", sbp->f_fstypename,8, &size); + + if (sbp != &mp->mnt_stat) { + sbp->f_type = mp->mnt_vfc->vfc_typenum; + sbp->f_owner = mp->mnt_stat.f_owner; + sbp->f_flags = mp->mnt_flag; + bcopy((caddr_t)mp->mnt_stat.f_mntonname, + (caddr_t)&sbp->f_mntonname[0], MNAMELEN); + bcopy((caddr_t)mp->mnt_stat.f_mntfromname, + (caddr_t)&sbp->f_mntfromname[0], MNAMELEN); + } + + return 0; +} +/* + * Convert an inode number into a locked vnode. + */ +int +minix_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +{ + struct minix_super_block *su; + struct minix_inode *ip; + struct minixmount *mmp; + struct vnode *vp; + dev_t dev; + int error; + + *vpp = NULL; + mmp = (struct minixmount*)(mp->mnt_data); + dev = mmp->mnx_dev; + su = mmp->mnx_su; + + /* Look for the vnode in the hash table first */ + +restart: + if ((*vpp = minix_ihashget(dev, ino)) != NULL) { + + vp = *vpp; + ip = VTOMI(vp); + + (void)minix_vinit(mp, minix_specop_p, minix_fifoop_p, vpp); + + if (ino == ROOT_INO) + vp->v_flag |= VROOT; + + return 0; + } + + if (minix_inode_hash_lock) { + while (minix_inode_hash_lock) { + minix_inode_hash_lock = -1; + tsleep(&minix_inode_hash_lock, PVM, "mnxfsgt", 0); + } + goto restart; + } + minix_inode_hash_lock = 1; + + /* Not in the hash table; so make a new vnode/inode pair. */ + + MALLOC(ip, struct minix_inode*,sizeof(struct minix_inode), + M_MINIXNOD, M_WAITOK); + + if ((error = minix_iget(mmp->mnx_devvp, su, (mino_t)ino, ip)) != 0) { + FREE(ip, M_MINIXNOD); + *vpp = NULL; + return error; + } + + /* Allocate a new vnode */ + + error = getnewvnode(VT_MINIXFS, mp, minix_vnodeop_p, &vp); + if (error) { + if (minix_inode_hash_lock < 0) + wakeup(&minix_inode_hash_lock); + minix_inode_hash_lock = 0; + *vpp = NULL; + FREE(ip, M_MINIXNOD); + return (error); + } + + vp->v_data = ip; /* connect vnode to inode */ + + /* Set up lock sharing in the stack of vnodes */ + + lockinit(&ip->i_lock, PINOD, "minix_inode", VLKTIMEOUT, LK_CANRECURSE); + vp->v_vnlock = &ip->i_lock; + + /* Load up the inode with info */ + + ip->i_vnode = vp; + ip->i_dev = dev; /* Specinfo pointer */ + ip->i_su = su; + ip->i_number = ino; + ip->i_parent = 0; /* Don't know this yet */ + ip->i_mmp = mmp; + ip->i_flag = 0; + ip->i_mode = ip->i_dino.i_mode; + ip->i_blocks = minix_num_blocks(ip->i_mode, ip->i_dino.i_size, su->s_zshift); + ip->i_count = 1; + ip->i_entry = 0; + ip->i_noent = 0; + + /* Put the inode into the hash table */ + + minix_ihashins(ip); /* This leads to panics after remounts! */ + + /* We just lock the inode here and forget about hashing for now. */ + + lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, curproc); + + if (minix_inode_hash_lock < 0) + wakeup(&minix_inode_hash_lock); + + minix_inode_hash_lock = 0; + + /* Put more good stuff into the vnode */ + + vp->v_type = minix_get_vtype(ip); + + if (ino == ROOT_INO) { + vp->v_flag |= VROOT; + ip->i_flag |= VROOT; + } + + error = minix_vinit(mp, minix_specop_p, minix_fifoop_p, &vp); + if (error) { + minix_ihashrem(ip); + FREE(ip, M_MINIXNOD); + vput(vp); + *vpp = NULL; + return error; + } + + /* Reference the device vnode */ + + VREF(su->s_devvp); + + *vpp = vp; + + return 0; +} + +static int +minix_sync(struct mount *mp, int waitfor, struct ucred *cred, struct proc *p) +{ + struct vnode *vp, *nvp; + struct minix_inode *ip; + struct minixmount *mmp; + struct minix_super_block *su; + int error, allerror = 0; + + mmp = (struct minixmount*)(mp->mnt_data); + su = mmp->mnx_su; + + /* + * Write back each (modified) inode. + */ + simple_lock(&mntvnode_slock); +loop: + for(vp=TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nvp) { + if (vp->v_mount != mp) + goto loop; + nvp = TAILQ_NEXT(vp, v_nmntvnodes); + ip = vp->v_data; + if (vp->v_type == VNON || ((ip->i_flag * + (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 && + TAILQ_EMPTY(&vp->v_dirtyblkhd))) + continue; + if (vp->v_type != VCHR) { + simple_unlock(&mntvnode_slock); + error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT, p); + if (error) { + simple_lock(&mntvnode_slock); + if (error == ENOENT) + goto loop; + } else { + if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) + allerror = error; + VOP_UNLOCK(vp, 0, p); + vrele(vp); + simple_lock(&mntvnode_slock); + } + + } else { + /* + * We must reference the vp to prevent it from + * getting ripped out from under UFS_UPDATE, since + * we are not holding a vnode lock. XXX why aren't + * we holding a vnode lock? + */ + VREF(vp); + simple_unlock(&mntvnode_slock); + minix_update(vp); + vrele(vp); + simple_lock(&mntvnode_slock); + } + if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp) + goto loop; + } + simple_unlock(&mntvnode_slock); + /* + * Force stale file system control information to be flushed. + */ + if (waitfor != MNT_LAZY) { + if (mmp->mnx_mp->mnt_flag & MNT_SOFTDEP) + waitfor = MNT_NOWAIT; + vn_lock(mmp->mnx_devvp, LK_EXCLUSIVE | LK_RETRY, p); + if ((error = VOP_FSYNC(mmp->mnx_devvp, cred, waitfor, p)) != 0) + allerror = error; + VOP_UNLOCK(mmp->mnx_devvp, 0, p); + } + return 0; +} + +static int +minix_start(struct mount *mp, int flags, struct proc *p) +{ + return 0; +} + +/* + * minix_init is called by kld when the minixfs is loaded. + */ +static int +minix_init(struct vfsconf *vfsp) +{ + static int done = 0; + + if (done == 1) + return 0; + + minix_inode_hash_lock = 0; + minix_ihashinit(); + done = 1; + + return 0; +} + +/* + * minix_uninit is called by kld when the minixfs is unloaded. + */ +static int +minix_uninit(struct vfsconf *vfsp) +{ + minix_ihashuninit(); + return 0; +} + +static struct vfsops minixfs_vfsops = { + minix_mount, + minix_start, + minix_unmount, + minix_root, + vfs_stdquotactl, + minix_statfs, + minix_sync, + minix_vget, + vfs_stdfhtovp, + vfs_stdcheckexp, + vfs_stdvptofh, + minix_init, + minix_uninit, + vfs_stdextattrctl, +}; + +VFS_SET(minixfs_vfsops, minixfs, 0); diff -ruN sys.orig/fs/minixfs/minix_vnops.c sys/fs/minixfs/minix_vnops.c --- sys.orig/fs/minixfs/minix_vnops.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_vnops.c Fri Feb 28 20:24:43 2003 @@ -0,0 +1,1722 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * This file has borrowed heavily from FreeBSD's ufs and ext2fs + * implementations. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +int minix_lookup(struct vop_cachedlookup_args*); +int minix_to_dirent_type(struct minix_inode*); +int minix_chown(struct vnode*,uid_t,gid_t,struct ucred*,struct proc*); +int minix_chmod(struct vnode*,int,struct ucred*,struct proc*); + +static int minix_fsync(struct vop_fsync_args*); +static int minix_inactive(struct vop_inactive_args*); +static int minix_reclaim(struct vop_reclaim_args*); +static int minix_readdir(struct vop_readdir_args*); +static int minix_readlink(struct vop_readlink_args*); +static int minix_symlink(struct vop_symlink_args*); +static int minix_open(struct vop_open_args*); +static int minix_close(struct vop_close_args*); +static int minix_create(struct vop_create_args*); +static int minix_remove(struct vop_remove_args*); +static int minix_link(struct vop_link_args*); +static int minix_mkdir(struct vop_mkdir_args*); +static int minix_rmdir(struct vop_rmdir_args*); +static int minix_read(struct vop_read_args*); +static int minix_write(struct vop_write_args*); +static int minix_bmap(struct vop_bmap_args*); +static int minix_getpages(struct vop_getpages_args*); +static int minix_putpages(struct vop_putpages_args*); +static int minix_access(struct vop_access_args*); +static int minix_getattr(struct vop_getattr_args*); +static int minix_rename(struct vop_rename_args*); +static int minix_setattr(struct vop_setattr_args*); +static int minix_mknod(struct vop_mknod_args*); +static int minixfifo_read(struct vop_read_args*); +static int minixfifo_write(struct vop_write_args*); +static int minixfifo_close(struct vop_close_args*); +static int minix_pathconf(struct vop_pathconf_args*); + +#define PRINTD(x) printf(x); +#undef PRINTD(x) +#define PRINTD(x) + +#undef MINIX_DEBUG + +vop_t **minix_vnodeop_p; +static struct vnodeopv_entry_desc minix_vnodeop_entries[] = { + { &vop_default_desc, (vop_t *) vop_defaultop }, + { &vop_cachedlookup_desc, (vop_t *) minix_lookup }, + { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_read_desc, (vop_t *) minix_read }, + { &vop_readdir_desc, (vop_t *) minix_readdir }, + { &vop_readlink_desc, (vop_t *) minix_readlink }, + { &vop_symlink_desc, (vop_t *) minix_symlink }, + { &vop_bmap_desc, (vop_t *) minix_bmap }, + { &vop_write_desc, (vop_t *) minix_write }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_setattr_desc, (vop_t *) minix_setattr }, + { &vop_open_desc, (vop_t *) minix_open }, + { &vop_close_desc, (vop_t *) minix_close }, + { &vop_create_desc, (vop_t *) minix_create }, + { &vop_remove_desc, (vop_t *) minix_remove }, + { &vop_link_desc, (vop_t *) minix_link }, + { &vop_mkdir_desc, (vop_t *) minix_mkdir }, + { &vop_rmdir_desc, (vop_t *) minix_rmdir }, + { &vop_rename_desc, (vop_t *) minix_rename }, + { &vop_mknod_desc, (vop_t *) minix_mknod }, + { &vop_pathconf_desc, (vop_t *) minix_pathconf }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_poll_desc, (vop_t *) vop_stdpoll }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { &vop_getpages_desc, (vop_t *) minix_getpages }, + { &vop_putpages_desc, (vop_t *) minix_putpages }, + { NULL, NULL } +}; + +static struct vnodeopv_desc minix_vnodeop_opv_desc = +{ &minix_vnodeop_p, minix_vnodeop_entries }; + +/* We do not implement read or write of device files for safety */ + +vop_t **minix_specop_p; +static struct vnodeopv_entry_desc minix_specop_entries[] = { + { &vop_default_desc, (vop_t *) vop_defaultop }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { NULL, NULL} +}; +static struct vnodeopv_desc minix_specop_opv_desc = + { &minix_specop_p, minix_specop_entries }; + +vop_t **minix_fifoop_p; +static struct vnodeopv_entry_desc minix_fifoop_entries[] = { + { &vop_default_desc, (vop_t *) fifo_vnoperate }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_setattr_desc, (vop_t *) minix_setattr }, + { &vop_read_desc, (vop_t *) minixfifo_read }, + { &vop_write_desc, (vop_t *) minixfifo_write }, + { &vop_close_desc, (vop_t *) minixfifo_close }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { NULL, NULL } +}; + +static struct vnodeopv_desc minix_fifoop_opv_desc = + { &minix_fifoop_p, minix_fifoop_entries }; + +VNODEOP_SET(minix_vnodeop_opv_desc); +VNODEOP_SET(minix_specop_opv_desc); +VNODEOP_SET(minix_fifoop_opv_desc); + +/* + * Called by vput(), vrele(), if usecount drops to zero. + * Also called by vclean() if use count has + * dropped to zero. + * This routine should clean release buffers associated + * with the vnode/inode back to the buffer cache, + * however, the vnode maintains its association with + * the filesystem. + */ + +/* + * Vnode usecount has dropped to zero; write or delete it. + * The node is locked when inactive is called, and is + * unlocked by inactive before it returns. + * Typically called from vrele, vput, vclean. + */ + +static int +minix_inactive(struct vop_inactive_args *ap) + /* + struct vop_inactive_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct proc *p = ap->a_p; + int mode, error = 0; + + PRINTD("Entering: minix_inactive\n") + + if (ip->i_mode == 0) + goto out; + + if (ip->i_nlink <= 0) { + error = minix_truncate(vp, (off_t)0, IO_SYNC, NOCRED, p); + ip->i_dev = 0; + mode = ip->i_mode; + ip->i_mode = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + minix_vfree(vp, ip->i_number, mode); + } + if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) + minix_update(vp); +out: + VOP_UNLOCK(vp, 0, p); + /* + * If we are done with the inode, reclaim it + * so that it can be reused immediately. + */ + if (ip->i_mode == 0) + vrecycle(vp, (struct simplelock *)0, p); + + return error; +} + +/* + * Called by vclean() after the buffers associated with the + * vnode have been released. VOP_INACTIVE is called if the + * usercount is zero to clean out the vnode. + * This routine actually frees the inode associated with + * the vnode to disassociate it from the file system. + */ +static int +minix_reclaim(struct vop_reclaim_args *ap) + /* + struct vop_reclaim_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct minix_super_block *sp = ip->i_su; + + minix_ihashrem(ip); + cache_purge(vp); + vrele(sp->s_devvp); + + FREE(ip, M_MINIXNOD); /* release inode space */ + vp->v_data = 0; + + return 0; +} + +static int +minix_fsync(struct vop_fsync_args *ap) + /* + struct vop_fsync_args { + struct vnode *a_vp; + struct ucred *a_cred; + int a_waitfor; + struct proc *a_p; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct buf *bp, *nbp; + int s; + +loop: + s = splbio(); + for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { + nbp = TAILQ_NEXT(bp, b_vnbufs); +/* + * Ignore buffers that are already being written. + */ + if (bp->b_flags & B_WRITEINPROG) + continue; +/* + * Make sure the buffer is dirty. + */ + if ((bp->b_flags & B_DELWRI) == 0) + panic("minix_fsync: not dirty"); + + vfs_bio_awrite(bp); + splx(s); + goto loop; + } + splx(s); + + if (ap->a_waitfor == MNT_WAIT) { + s = splbio(); + while (vp->v_numoutput) { + vp->v_flag |= VBWAIT; + tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "mnxfsn",0); + } + splx(s); +#ifdef DIAGNOSTIC + if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) { + vprint("minix_fsync: dirty", vp); + goto loop; + } +#endif + } + splx(s); + + ip->i_flag |= IN_UPDATE; + return minix_update(vp); +} + +static int +minix_access(struct vop_access_args *ap) +/* + struct vop_access_args { + struct vnode *a_vp; + int a_mode; + struct ucred *a_cred; + struct proc *a_p; + }; +*/ +{ + struct vnode *vp = ap->a_vp; + struct ucred *cred = ap->a_cred; + int mode = ap->a_mode; + + struct minix_dinode *dip; + struct minix_inode *ip; + + ip = VTOMI(vp); + dip = &ip->i_dino; + + return minix_dinode_access(dip, mode, cred, ip->i_su); +} + +static int +minix_getattr(struct vop_getattr_args *ap) + /* + struct vop_getattr_args { + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct vattr *vap = ap->a_vap; + struct minix_dinode *dip = &(ip->i_dino); + + minix_itimes(vp); + + vap->va_fsid = dev2udev(ip->i_dev); + vap->va_fileid = ip->i_number; + vap->va_mode = ip->i_mode & ALL_MODES; /* Minix and ufs agree here */ + vap->va_nlink = dip->i_nlinks; + vap->va_uid = dip->i_uid; + vap->va_gid = dip->i_gid; + vap->va_rdev = dip->i_block[0]; + vap->va_size = dip->i_size; + vap->va_atime.tv_sec = dip->i_atime; + vap->va_atime.tv_nsec = (dip->i_atime)*1000000000; + vap->va_mtime.tv_sec = dip->i_mtime; + vap->va_mtime.tv_nsec = (dip->i_mtime)*1000000000; + vap->va_ctime.tv_sec = dip->i_ctime; + vap->va_ctime.tv_nsec = (dip->i_ctime)*1000000000; + vap->va_flags = 0; /* Minix has no chflags command */ + vap->va_gen = 0; /* I don't know what this is */ + vap->va_blocksize = BLOCK_SIZE; + vap->va_bytes = ((dip->i_size + BLOCK_SIZE-1) & ~(BLOCK_SIZE-1)) + + BLOCK_SIZE; + vap->va_filerev = 0; /* NFS is not relevant yet */ +/* vap->va_type = minix_get_vtype(ip); */ + vap->va_type = IFTOVT(ip->i_mode); /* IFTOVT() also works for minix */ + + return 0; +} + +static int +minix_setattr(struct vop_setattr_args *ap) + /* + struct vop_setattr_args { + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; + } + */ +{ + struct vattr *vap = ap->a_vap; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct ucred *cred = ap->a_cred; + struct proc *p = ap->a_p; + int error; + /* + * Check for unsettable attributes. + */ + if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || + (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || + (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || + ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { + return EINVAL; + } + + /* Minix doesn't have chflags capability */ + + if (vap->va_flags != VNOVAL) + printf("minix_setattr: FLAGS NOT SET\n"); + /* + * Go through the fields and update iff not VNOVAL. + */ + if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + if ((error = minix_chown(vp, vap->va_uid, vap->va_gid, cred, p)) != 0) + return error; + } + if (vap->va_size != VNOVAL) { + /* + * Disallow write attempts on read-only file systems; + * unless the file is a socket, fifo, or a block or + * character device resident on the file system. + */ + switch (vp->v_type) { + case VDIR: + return EISDIR; + case VLNK: + case VREG: + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + break; + default: + break; + } + if ((error = minix_truncate(vp, vap->va_size, IO_SYNC, cred, p)) != 0) + return error; + } + if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + if (cred->cr_uid != dip->i_uid && + (error = suser_xxx(cred, p, PRISON_ROOT)) && + ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || + (error = VOP_ACCESS(vp, VWRITE, cred, p)))) + return error; + if (vap->va_atime.tv_sec != VNOVAL) + ip->i_flag |= IN_ACCESS; + if (vap->va_mtime.tv_sec != VNOVAL) + ip->i_flag |= IN_CHANGE | IN_UPDATE; + minix_itimes(vp); + if (vap->va_atime.tv_sec != VNOVAL) { + dip->i_atime = vap->va_atime.tv_sec; + } + if (vap->va_mtime.tv_sec != VNOVAL) { + dip->i_mtime = vap->va_mtime.tv_sec; + } + if ((error = minix_update(vp)) != 0) + return error; + } + error = 0; + if (vap->va_mode != (mode_t)VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + error = minix_chmod(vp, (int)vap->va_mode, cred, p); + } + + return error; +} + +static int +minix_readdir(struct vop_readdir_args *ap) + /* + struct vop_readdir_args { + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; + int *a_eofflag; + int *ncookies; + u_long **a_cookies; + }; + */ +{ + struct uio *uio = ap->a_uio; + int count, lost, error, err; + struct vnode *vp = ap->a_vp; + struct vnode *devvp; + struct minix_inode in, *ip = VTOMI(vp); + struct minix_super_block *sp; + struct mount *mp = vp->v_mount; + struct minixmount *mmp; + + struct minix_direct *edp, *dp; + int ncookies; + struct dirent dstdp; + struct uio auio; + struct iovec aiov; + caddr_t dirbuf; + int DIRBLKSIZ = BLOCK_SIZE; + int smdsize = sizeof(struct minix_direct); + int readcnt; + off_t startoffset = uio->uio_offset; + + mmp = (struct minixmount*)mp->mnt_data; + sp = mmp->mnx_su; + devvp = mmp->mnx_devvp; + + count = uio->uio_resid; + /* + * Make sure we don't return partial entries. + */ + if (count <= ((uio->uio_offset + count) & (DIRBLKSIZ -1))) + return EINVAL; + count -= (uio->uio_offset + count) & (DIRBLKSIZ -1); + lost = uio->uio_resid - count; + uio->uio_resid = count; + uio->uio_iov->iov_len = count; + + auio = *uio; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_resid = count; + auio.uio_segflg = UIO_SYSSPACE; + aiov.iov_len = count; + MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); + aiov.iov_base = dirbuf; + if ((error = VOP_READ(vp, &auio, 0, ap->a_cred)) == 0) { + readcnt = count - auio.uio_resid; + edp = (struct minix_direct *)&dirbuf[readcnt]; + ncookies = 0; + bzero(&dstdp, offsetof(struct dirent, d_name)); + for (dp = (struct minix_direct *)dirbuf; + !error && uio->uio_resid > 0 && dp < edp; ) { + /* + * Minix directory entries: + * - the name is NUL-terminated except for max length name. + * - no file type and no namelength. + * - so we get the file type from the inode + * - and the namelength from strlen(). + * - The record size for each entry is calculated + * - from GENERIC_DIRSIZ(). + */ + bzero(dstdp.d_name, MAXNAMLEN+1); + if (dp->d_ino > 0) { + dstdp.d_fileno = dp->d_ino; + if ((err = minix_iget(devvp,sp,dp->d_ino,&in)) != 0) + return err; + dstdp.d_type = minix_to_dirent_type(&in); + strncpy(dstdp.d_name, dp->d_name, MINIX_NAME_MAX); + dstdp.d_name[MINIX_NAME_MAX] = '\0'; + dstdp.d_namlen = strlen(dstdp.d_name); + dstdp.d_reclen = GENERIC_DIRSIZ(&dstdp); + } else { + dstdp.d_fileno = 0; + dstdp.d_type = DT_UNKNOWN; + dstdp.d_namlen = 0; + dstdp.d_name[0] = '\0'; + dstdp.d_reclen = GENERIC_DIRSIZ(&dstdp); + } + + if(dstdp.d_reclen <= uio->uio_resid) { + if (dstdp.d_fileno > 0) /* Only move entries that are valid */ + error = uiomove((caddr_t)&dstdp, dstdp.d_reclen, uio); + else { /* Invalid entry so go to the next entry */ + error = 0; + } + if (!error) + ncookies++; + } else + break; + + dp++; + } + /* we need to correct uio_offset */ + uio->uio_offset = startoffset + (caddr_t)dp - dirbuf; + + if (!error && ap->a_ncookies != NULL) { + u_long *cookiep, *cookies, *ecookies; + off_t off; + + if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) + panic("minix_readdir: unexpected uio from NFS server"); + MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, + M_WAITOK); + off = startoffset; + for (dp = (struct minix_direct *)dirbuf, + cookiep = cookies, ecookies = cookies + ncookies; + cookiep < ecookies; + dp = (struct minix_direct *)((caddr_t) dp + smdsize)) { + off += smdsize; + *cookiep++ = (u_long) off; + } + *ap->a_ncookies = ncookies; + *ap->a_cookies = cookies; + } + } + FREE(dirbuf, M_TEMP); + uio->uio_resid += lost; + if (ap->a_eofflag) + *ap->a_eofflag = ip->i_dino.i_size <= uio->uio_offset; + return error; +} +/* + * Make a symbolic link; follows ufs treatment. + * + * Symbolic links are not supported in Minix 2.0 + * but are useful in FreeBSD for amoung other things + * running Emacs on a file in the Minixfs. :) + */ +static int +minix_symlink(struct vop_symlink_args *ap) + /* + struct vop_symlink_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + char *a_target; + }; + */ +{ + struct vnode *vp, **vpp = ap->a_vpp; + struct minix_inode *ip; + int len, error; + + error = minix_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, + vpp, ap->a_cnp); + if (error) + return error; + + vp = *vpp; + len = strlen(ap->a_target); + if (len > MINIX_MAXSYMLINK) + return ENAMETOOLONG; + if (len < vp->v_mount->mnt_maxsymlinklen) { + ip = VTOMI(vp); + bzero((char*)ip->i_shortlink, MINIX_MAXSYMLINKLEN); + bcopy(ap->a_target, (char*)ip->i_shortlink, len); + ip->i_dino.i_size = len; + ip->i_blocks = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + } else + error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0, + UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int*)0, + (struct proc*)0); + if (error) + vput(vp); + + cache_purge(ap->a_dvp); + return minix_update(vp); +} +/* + * Read a symbolic link; follows ufs treatment + */ +static int +minix_readlink(struct vop_readlink_args *ap) + /* + struct vop_reaklink_args { + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = (struct minix_inode*)vp->v_data; + int isize; + + isize = ip->i_dino.i_size; + if (isize < vp->v_mount->mnt_maxsymlinklen) { + uiomove((char*)ip->i_shortlink, isize, ap->a_uio); + return 0; + } + return VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred); +} + +static int +minix_bmap(struct vop_bmap_args *ap) + /* + struct vop_bmap_args { + struct vnode *a_vp; + struct daddr_t a_bn; + struct vnode **a_vpp; + struct daddr_t *a_bnp; + int *a_runp; + int *a_runb; + }; + */ +{ + struct minixmount *mmp; + + if (ap->a_vpp != NULL) { + mmp = (struct minixmount*)(ap->a_vp->v_mount->mnt_data); + *ap->a_vpp = mmp->mnx_devvp; + } + if (ap->a_bnp == NULL) + return 0; + + if (ap->a_runb != NULL) /* No cluster reads */ + *ap->a_runb = 0; + + return minix_bmapfs(ap->a_vp, ap->a_bn, ap->a_bnp, ap->a_runp); +} +static int +minix_open(struct vop_open_args *ap) +{ + return 0; +} +static int +minix_close(struct vop_close_args *ap) +{ + struct vnode *vp = ap->a_vp; + + simple_lock(&vp->v_interlock); + if (vp->v_usecount > 1) + minix_itimes(vp); + simple_unlock(&vp->v_interlock); + + return 0; +} +/* + * Vnode op for reading. + */ +static int +minix_read(struct vop_read_args *ap) + /* + struct vop_read_args { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct uio *uio = ap->a_uio; + + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + + struct buf *bp; + off_t bytesinfile; + u_daddr_t lbn, pbn; + long size, xfersize, blkoffset; + int error, orig_resid; + + size = BLOCK_SIZE; + + orig_resid = uio->uio_resid; + for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { + bytesinfile = (off_t)dip->i_size - uio->uio_offset; + if (bytesinfile <= 0) + break; + + lbn = uio->uio_offset / size; + blkoffset = uio->uio_offset - lbn * size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (bytesinfile < xfersize) + xfersize = bytesinfile; + + if ((error = VOP_BMAP(vp, lbn, NULL, &pbn, NULL, NULL)) != 0) + return error; + + if (pbn < 0) + return EIO; + + if ((error = bread(devvp, pbn, size, NOCRED, &bp)) != 0) { + brelse(bp); + bp = NULL; + break; + } + + /* + * We should only get non-zero b_resid when an I/O error + * has occurred, which should cause us to break above. + * However, if the short read did not cause an error, + * then we want to ensure that we do not uiomove bad + * or uninitialized data. + */ + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) + break; + xfersize = size; + } + + error = uiomove((char *)bp->b_data+blkoffset, (int)xfersize, uio); + if (error) + break; + + bqrelse(bp); + } + if (bp != NULL) + bqrelse(bp); + + if (orig_resid > 0 && (error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { + ip->i_flag |= IN_ACCESS; + (void)minix_update(vp); + } + + return error; +} +/* + * Vnode op for writing. + */ +static int +minix_write(struct vop_write_args *ap) + /* + struct vop_write_args { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct uio *uio = ap->a_uio; + struct ucred *cred = ap->a_cred; + int ioflag = ap->a_ioflag; + struct buf *bp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lbn, pbn; + off_t osize; + long size, resid, blkoffset, xfersize = 0; + int flags, error; + + osize = (off_t)dip->i_size; + size = BLOCK_SIZE; + resid = uio->uio_resid; + + if (ioflag & IO_SYNC) + flags = B_SYNC; + else + flags = 0; + + for (error = 0; uio->uio_resid > 0;) { + lbn = uio->uio_offset/size; + blkoffset = uio->uio_offset - lbn*size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + + flags |= B_CLRBUF; /* All the time */ + + if (uio->uio_offset + xfersize > dip->i_size) { + vnode_pager_setsize(vp, (vm_ooffset_t)(uio->uio_offset + xfersize)); + if ((error = minix_balloc(vp, lbn, &bp)) != 0) + break; + } else { + if ((error = minix_bmapfs(vp, lbn, &pbn, NULL)) != 0) + break; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) + break; + } + + if (uio->uio_offset + xfersize > dip->i_size) { + dip->i_size = uio->uio_offset + xfersize; + ip->i_blocks = minix_num_blocks(ip->i_mode, dip->i_size, sp->s_zshift); + } + + error = uiomove((char*)bp->b_data+blkoffset, (int)xfersize, uio); + + if (ioflag & IO_VMIO) + bp->b_flags |= B_RELBUF; + + if (ioflag & IO_SYNC) + bwrite(bp); + else if (xfersize + blkoffset == BLOCK_SIZE) + bawrite(bp); + else + bdwrite(bp); + + if (error || xfersize == 0) + break; + } + + if (error) { + if (ioflag & IO_UNIT) { + (void)minix_truncate(vp,osize,ioflag & IO_SYNC, cred, uio->uio_procp); + uio->uio_offset -= resid - uio->uio_resid; + uio->uio_resid = resid; + } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { + (void)minix_update(vp); + } + } + /* + * If we successfully wrote any data, and we are not the superuser + * we clear the setuid and setgid bits as a precaution against + * tampering. + */ + if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0) + ip->i_mode &= ~(ISUID | ISGID); + + if (xfersize > 0 && error == 0) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + (void)minix_update(vp); + } + + return error; +} + +static int +minix_create(struct vop_create_args *ap) +{ + struct componentname *cnp = ap->a_cnp; + int mode; + + if (strlen(cnp->cn_nameptr) > MINIX_NAME_MAX) + return ENAMETOOLONG; + + mode = MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode); + + return minix_makeinode(mode,ap->a_dvp, ap->a_vpp, cnp); +} +/* + * Just remove the directory entry and decrease the link count + * of the file, after a call to minix_namei(). + */ +static int +minix_remove(struct vop_remove_args *ap) +{ + struct vnode *vp = ap->a_vp; + struct vnode *dvp = ap->a_dvp; + struct minix_inode *ip = VTOMI(vp); + int error; + int prtrmv = 0; + + if ((error = minix_dirremove(dvp)) == 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + } + + if (error) + return error; + + if (prtrmv) { + vprint("remove: parent directory",dvp); + vprint("remove: source file",vp); + } + + return minix_update(dvp); +} +/* + * Add a link in a directory + */ +static int +minix_link(struct vop_link_args *ap) + /* + struct vop_link_args { + struct vnode *a_tdvp; + struct vnode *a_vp; + struct componentname *a_cnp; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct vnode *tdvp = ap->a_tdvp; + struct componentname *cnp = ap->a_cnp; + struct proc *p = cnp->cn_proc; + struct minix_inode *ip; + struct minix_direct newdir; + int error; + + if (tdvp->v_mount != vp->v_mount) + return EXDEV; + + if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) + return error; + + ip = VTOMI(vp); + if (ip->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto out; + } + ip->i_nlink++; + ip->i_flag |= IN_CHANGE; + if ((error = minix_update(vp)) == 0) { + minix_makedirentry(ip, cnp, &newdir); + if ((error = minix_direnter(tdvp, vp, &newdir, cnp)) != 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + (void)minix_update(vp); + } + } +out: + if (tdvp != vp) + VOP_UNLOCK(vp, 0, p); + + return error; +} +/* + * Mkdir system call. + */ +static int +minix_mkdir(struct vop_mkdir_args *ap) + /* + struct vop_mkdir_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + }; + */ +{ + struct vnode *dvp = ap->a_dvp; + struct vattr *vap = ap->a_vap; + struct componentname *cnp = ap->a_cnp; + struct minix_inode *dp = VTOMI(dvp); + struct vnode *tvp; + struct minix_inode *ip = NULL; + struct minix_dinode *dip; + struct minix_super_block *sp; + struct buf *bp; + struct minix_dirtemplate dirtemplate, *dtp; + struct minix_direct newdir; + int error, dmode; + struct minix_dirtemplate mastertemplate = { + 0, ".", + 0, ".." + }; + + if (dp->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto out; + } + dmode = vap->va_mode &0777; + dmode |= IFDIR; + + if ((error = minix_valloc(dvp, dmode, cnp->cn_cred, &tvp)) != 0) + goto out; + + ip = (struct minix_inode*)tvp->v_data; + sp = ip->i_su; + dip = &(ip->i_dino); + ip->i_dino.i_gid = dp->i_dino.i_gid; + ip->i_dino.i_uid = cnp->cn_cred->cr_uid; + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + ip->i_mode = dmode; + ip->i_dino.i_mode = dmode; + tvp->v_type = VDIR; + ip->i_nlink = 2; + /* + * Bump link count in parent directory to reflect work done below. + * Should be done before reference is created so cleanup is + * possible if we crash. + */ + dp->i_nlink++; + dp->i_flag |= IN_CHANGE; + if ((error = minix_update(tvp)) != 0) + goto bad; + /* + * Initialize directory with "." and ".." from static template. + */ + dtp = &mastertemplate; + dirtemplate = *dtp; + dirtemplate.dot_ino = ip->i_number; + dirtemplate.dotdot_ino = dp->i_number; + if ((error = minix_balloc(tvp, (u_daddr_t)0, &bp)) != 0) + goto bad; + dip->i_size = sizeof(dirtemplate); + ip->i_blocks = 1 << sp->s_zshift; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + vnode_pager_setsize(tvp, (vm_ooffset_t)BLOCK_SIZE); + bcopy((caddr_t)&dirtemplate, (caddr_t)bp->b_data, sizeof(dirtemplate)); + + if ((error = minix_update(tvp)) != 0) { + (void)bwrite(bp); + goto bad; + } + /* + * Directory set up, now install its entry in the parent directory. + * + * If we are not doing soft dependencies, then we must write out the + * buffer containing the new directory body before entering the new + * name in the parent. If we are doing soft dependencies, then the + * buffer containing the new directory body will be passed to and + * released in the soft dependency code after the code has attached + * an appropriate ordering dependency to the buffer which ensures that + * the buffer is written before the new name is written in the parent. + */ + if ((error = bwrite(bp)) != 0) + goto bad; + + minix_makedirentry(ip, cnp, &newdir); + error = minix_direnter(dvp, tvp, &newdir, cnp); +bad: + if (error == 0) { + *ap->a_vpp = tvp; + } else { + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + /* + * No need to do an explicit VOP_TRUNCATE here, vrele will + * do this for us because we set the link count to 0. + */ + ip->i_nlink = 0; + ip->i_flag |= IN_CHANGE; + vput(tvp); + } +out: + return error; +} +/* + * Rmdir system call + */ +static int +minix_rmdir(struct vop_rmdir_args *ap) + /* + struct vop_rmdir_args { + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct vnode *dvp = ap->a_dvp; + struct componentname *cnp = ap->a_cnp; + struct proc *p = cnp->cn_proc; + struct minix_inode *ip, *dp; + int error, ioflag = IO_SYNC; + int prmdir = 0; + + ip = VTOMI(vp); + dp = VTOMI(dvp); + + /* + * Do not remove a directory that is in the process of being renamed. + * Verify the directory is empty (and valid). Rmdir ".." will not be + * valid since ".." will contain a reference to the current directory + * and thus be non-empty. Do not allow the removal of mounted on + * directories (this can happen when an NFS exported filesystem + * tries to remove a locally mounted on directory). + */ + error = 0; + if (ip->i_flag & IN_RENAME) { + error = EINVAL; + goto out; + } + if (ip->i_nlink > 2 || + !minix_dirempty(ip, dp->i_number, cnp->cn_cred)) { + error = ENOTEMPTY; + goto out; + } + if (vp->v_mountedhere != 0) { + error = EINVAL; + goto out; + } + /* + * Delete reference to directory before purging + * inode. If we crash in between, the directory + * will be reattached to lost+found, + */ + if ((error = minix_dirremove(dvp)) != 0) + goto out; + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + cache_purge(dvp); + VOP_UNLOCK(dvp, 0, p); + (void)minix_update(dvp); + /* + * Truncate inode. The only stuff left in the directory is "." and + * "..". The "." reference is inconsequential since we are quashing + * it. + */ + ip->i_nlink -= 2; + ip->i_flag |= IN_CHANGE; + error = minix_truncate(vp, (off_t)0, ioflag, cnp->cn_cred, p); + cache_purge(vp); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); +out: + if (prmdir) { + vprint("rmdir: parent directory",dvp); + vprint("rmdir: source directory",vp); + } + return error; +} +/* + * mknod system call + */ +static int +minix_mknod(struct vop_mknod_args *ap) + /* + struct vop_mknod_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + }; + */ +{ + struct vnode **vpp = ap->a_vpp; + struct vattr *vap = ap->a_vap; + struct minix_inode *ip; + ino_t ino; + int error; + + error = minix_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), + ap->a_dvp, vpp, ap->a_cnp); + if (error) + return error; + ip = VTOMI(*vpp); + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + if (vap->va_rdev != VNOVAL) + ip->i_rdev = vap->va_rdev; + /* + * Remove inode, then reload it through VFS_VGET so it is + * checked to see if it is an alias of an existing entry in + * the inode cache. + */ + vput(*vpp); + (*vpp)->v_type = VNON; + ino = ip->i_number; /* Save this before vgone() invalidates ip. */ + vgone(*vpp); + if ((error = VFS_VGET(ap->a_dvp->v_mount, ino, vpp)) != 0) { + *vpp = NULL; + return error; + } + return minix_update(*vpp); +} +/* + * Rename system call. Follows FreeBSD's ufs. + * rename("foo", "bar"); + * is essentially + * unlink("bar"); + * link("foo", "bar"); + * unlink("foo"); + * but ``atomically''. Can't do full commit without saving state in the + * inode on disk which isn't feasible at this time. Best we can do is + * always guarantee the target exists. + * + * Basic algorithm is: + * + * 1) Bump link count on source while we're linking it to the + * target. This also ensures the inode won't be deleted out + * from underneath us while we work (it may be truncated by + * a concurrent `trunc' or `open' for creation). + * 2) Link source to destination. If destination already exists, + * delete it first. + * 3) Unlink source reference to inode if still around. If a + * directory was moved and the parent of the destination + * is different from the source, patch the ".." entry in the + * directory. + */ +static int +minix_rename(struct vop_rename_args *ap) + /* + struct vop_rename_args { + struct vnode *ap_fdvp; + struct vnode *ap_fvp; + struct componentname *ap_fcnp; + struct vnode *ap_tdvp; + struct vnode *ap_tvp; + struct componentname *ap_tcnp; + }; + */ +{ + /* + * fdvp is the old parent directory + * fvp is the file to be renamed + * fcnp is the path info about the current file: fvp + * tdvp is the new parent directory + * tvp is the new 'target' file name (if it exists) + * tcnp is the path info about the file's new name + */ + struct vnode *tvp = ap->a_tvp; + register struct vnode *tdvp = ap->a_tdvp; + struct vnode *fvp = ap->a_fvp; + struct vnode *fdvp = ap->a_fdvp; + struct componentname *tcnp = ap->a_tcnp; + struct componentname *fcnp = ap->a_fcnp; + struct proc *p = fcnp->cn_proc; + struct minix_inode *ip, *xp, *dp; + struct minix_direct newdir; + int doingdirectory = 0, oldparent = 0, newparent = 0; + int entry, error = 0, ioflag = IO_SYNC; + + /* + * Check for cross-device rename. + */ + if ((fvp->v_mount != tdvp->v_mount) || + (tvp && (fvp->v_mount != tvp->v_mount))) { + error = EXDEV; + abortit: + if (tdvp == tvp) + vrele(tdvp); + else + vput(tdvp); + if (tvp) + vput(tvp); + vrele(fdvp); + vrele(fvp); + return error; + } + /* + * Check if just deleting a link name. + */ + if (fvp == tvp) { + if (fvp->v_type == VDIR) { + error = ENOENT; + goto abortit; + } + + /* + * Release destination. + */ + vput(tdvp); + vput(tvp); + /* + * Delete source. Pretty bizarre stuff. + */ + vrele(fdvp); + vrele(fvp); + fcnp->cn_flags &= ~MODMASK; + fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; + fcnp->cn_nameiop = DELETE; + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); + if (error == 0) + vrele(fdvp); + if (fvp == NULL) + return ENOENT; + error = VOP_REMOVE(fdvp, fvp, fcnp); + if (fdvp == fvp) + vrele(fdvp); + else + vput(fdvp); + if (fvp != NULL) + vput(fvp); + return error; + } + + if ((error = vn_lock(fvp, LK_EXCLUSIVE, p)) != 0) + goto abortit; + + dp = VTOMI(fdvp); /* From directory */ + ip = VTOMI(fvp); /* From inode */ + + if (ip->i_nlink >= MINIX_LINK_MAX) { + VOP_UNLOCK(fvp, 0, p); + error = EMLINK; + goto abortit; + } + + if ((ip->i_mode & IFMT) == IFDIR) { + /* + * Avoid ".", "..", and aliases of "." for obvious reasons. + */ + if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') + || dp->i_number == ip->i_number + || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { + VOP_UNLOCK(fvp, 0, p); + error = EINVAL; + goto abortit; + } + ip->i_flag |= IN_RENAME; + oldparent = dp->i_number; + doingdirectory = 1; + } + vrele(fdvp); + + /* + * When the target exists, both the directory + * and target vnodes are returned locked. + */ + + dp = VTOMI(tdvp); /* dp is now the target directory */ + xp = NULL; + if (tvp) + xp = VTOMI(tvp); /* xp is now the target file name */ + + /* + * Bump link count on fvp while we are moving stuff around. If we + * crash before completing the work, the link count may be wrong + * but correctable. + */ + ip->i_nlink++; + ip->i_flag |= IN_CHANGE; + if ((error = minix_update(fvp)) != 0) { + VOP_UNLOCK(fvp, 0, p); + goto bad; + } + + /* + * If ".." must be changed (ie the directory gets a new + * parent) then the source directory must not be in the + * directory hierarchy above the target, as this would + * orphan everything below the source directory. Also + * the user must have write permission in the source so + * as to be able to change "..". + */ + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); + VOP_UNLOCK(fvp, 0, p); + if (oldparent != dp->i_number) + newparent = dp->i_number; + if (doingdirectory && newparent) { + if (error) /* write access check above */ + goto bad; + if (xp != NULL) + vput(tvp); + if ((error = minix_checkpath(ip, dp, tcnp->cn_cred)) != 0) + goto out; + VREF(tdvp); + error = relookup(tdvp, &tvp, tcnp); + if (error) + goto out; + vrele(tdvp); + dp = VTOMI(tdvp); + xp = NULL; + if (tvp) + xp = VTOMI(tvp); + } + +/* + * If the target doesn't exist, link the target to the source and + * unlink the source. Otherwise, rewrite the target directory to + * reference the source and remove the original entry. + */ + if (xp == NULL) { + if (dp->i_dev != ip->i_dev) + panic("minix_rename: EXDEV"); + /* + * Account for ".." in new directory. + * When source and destination have the same + * parent we don't fool with the link count. + */ + if (doingdirectory && newparent) { + if ((nlink_t)dp->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto bad; + } + dp->i_nlink++; + dp->i_flag |= IN_CHANGE; + if ((error = minix_update(tdvp)) != 0) + goto bad; + } + minix_makedirentry(ip, tcnp, &newdir); + error = minix_direnter(tdvp, NULL, &newdir, tcnp); + + if (error) { + if (doingdirectory && newparent) { + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + (void)minix_update(tdvp); + } + goto bad; + } + vput(tdvp); + } else { + + if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev) + panic("minix_rename: EXDEV"); + /* + * Target must be empty if a directory and have no links + * to it. Also, ensure source and target are compatible + * (both directories, or both not directories). + */ + if ((xp->i_mode&IFMT) == IFDIR) { + if ((xp->i_nlink > 2) || + !minix_dirempty(xp, dp->i_number, tcnp->cn_cred)) { + error = ENOTEMPTY; + goto bad; + } + if (!doingdirectory) { + error = ENOTDIR; + goto bad; + } + /* + * Update name cache since directory is going away. + */ + cache_purge(tdvp); + + } else if (doingdirectory) { + error = EISDIR; + goto bad; + } + + /* + * Change name tcnp in tdvp to point at fvp. + */ + + if ((entry = dp->i_entry) < 2) { + printf("rename: i_entry < 2\n"); + error = EIO; + goto bad; + } + + if ((error = minix_dirrewrite(dp, xp, ip->i_number, entry)) != 0) + goto bad; + + /* + * If the target directory is in same directory as the source + * directory, decrement the link count on the parent of the + * target directory. This accounts for the fact that a + * directory links back to its parent with .. + */ + + if (doingdirectory) { + if (!newparent) { + /* Decrement the link count of tdvp */ + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + } + xp->i_nlink--; + xp->i_flag |= IN_CHANGE; + if (--xp->i_nlink != 0) + panic("minix_rename: linked directory"); + if ((error = minix_truncate(tvp, (off_t)0, ioflag, + tcnp->cn_cred, tcnp->cn_proc)) != 0) + goto bad; + } + + vput(tdvp); + vput(tvp); + xp = NULL; + } +/* + * Unlink the source. If a directory was moved to a new parent, + * update its ".." entry. Gobs of ugly UFS code omitted here. + */ + fcnp->cn_flags &= ~MODMASK; + fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); /* Relookup gets a new vnode/inode */ + if (error == 0) + vrele(fdvp); + if (fvp != NULL) { + xp = VTOMI(fvp); + dp = VTOMI(fdvp); + } else { + /* + * From name has disappeared. + */ + if (doingdirectory) + panic("minix_rename: lost dir entry"); + vrele(ap->a_fvp); + return (0); + } +/* + * Ensure that the directory entry still exists and has not + * changed while the new name has been entered. If the source is + * a file then the entry may have been unlinked or renamed. In + * either case there is no further work to be done. If the source + * is a directory then it cannot have been rmdir'ed; the IN_RENAME + * flag ensures that it cannot be moved by another rename or removed + * by a rmdir. + */ + if (xp->i_number != ip->i_number) { /* Need to compare inode numbers here */ + if (doingdirectory) + panic("minix_rename: lost dir entry"); + } else { + /* + * If the source is a directory with a + * new parent, the link count of the old + * parent directory must be decremented + * and ".." set to point to the new parent. + */ + if (doingdirectory && newparent) { + entry = 1; /* entry #1 is '..' in a Minix directory */ + minix_dirrewrite(xp, dp, newparent, entry); + cache_purge(fdvp); + } + if((error = minix_dirremove(fdvp)) != 0) + printf("minix_dirremove: error = %d\n",error); + if (!error) { + cache_purge(fvp); + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + ip->i_flag &= ~IN_RENAME; + (void)minix_update(fvp); + dp->i_flag |= IN_CHANGE | IN_UPDATE; + (void)minix_update(fdvp); + } + } + if (dp) + vput(dp->i_vnode); + if (xp) + vput(xp->i_vnode); + vrele(ap->a_fvp); + return error; + +bad: + if (xp) + vput(xp->i_vnode); + if (dp) + vput(dp->i_vnode); +out: + if (doingdirectory) + ip->i_flag &= ~IN_RENAME; + if (vn_lock(fvp, LK_EXCLUSIVE, p) == 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + ip->i_flag &= ~IN_RENAME; + (void)minix_update(fvp); + vput(fvp); + } else + vrele(fvp); + + return error; +} +/* + * Return POSIX pathconf information applicable to minix filesystems. + */ +static int +minix_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + int *a_retval; + } */ *ap; +{ + switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = MINIX_LINK_MAX; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = MINIX_NAME_MAX; + return (0); + case _PC_PATH_MAX: + *ap->a_retval = MINIX_PATH_MAX; + return (0); + case _PC_PIPE_BUF: + *ap->a_retval = MINIX_PIPE_BUF; + return (0); + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = 1; + return (0); + case _PC_NO_TRUNC: + *ap->a_retval = 1; + return (0); + default: + return (EINVAL); + } + /* NOTREACHED */ +} +/* The fifo calls below follow ufs's fifofs */ +/* + * Update the times on the inode for the fifo then close + */ +static int +minixfifo_close(struct vop_close_args *ap) +{ + struct vnode *vp = ap->a_vp; + + simple_lock(&vp->v_interlock); + if (vp->v_usecount > 1) + minix_itimes(vp); + simple_unlock(&vp->v_interlock); + return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); +} +/* + * Read wrapper for fifos. + */ +static int +minixfifo_read(struct vop_read_args *ap) +{ + int error, resid; + struct uio *uio = ap->a_uio; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + + resid = uio->uio_resid; + error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap); + if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && + ip != NULL && (uio->uio_resid != resid || + (error == 0 && resid != 0))) + ip->i_flag |= IN_ACCESS; + return error; +} +/* + * Write wrapper for fifos. + */ +static int +minixfifo_write(struct vop_write_args *ap) +{ + int error, resid; + struct uio *uio = ap->a_uio; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + + resid = uio->uio_resid; + error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap); + if (ip != NULL && (uio->uio_resid != resid ||(error == 0 && resid != 0))) + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return error; +} +static int +minix_getpages(struct vop_getpages_args *ap) +{ + return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_reqpage); +} +static int +minix_putpages(struct vop_putpages_args *ap) +{ + return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_sync, ap->a_rtvals); +} diff -ruN sys.orig/modules/Makefile sys/modules/Makefile --- sys.orig/modules/Makefile Sat May 4 01:23:52 2002 +++ sys/modules/Makefile Fri Feb 28 13:46:46 2003 @@ -102,6 +102,7 @@ gnufpu \ ibcs2 \ linprocfs \ + minixfs \ mly \ ncv \ nsp \ diff -ruN sys.orig/modules/minixfs/Makefile sys/modules/minixfs/Makefile --- sys.orig/modules/minixfs/Makefile Wed Dec 31 16:00:00 1969 +++ sys/modules/minixfs/Makefile Fri Feb 28 13:46:44 2003 @@ -0,0 +1,11 @@ +# $FreeBSD: src/sys/modules/minixfs/Makefile,v 1.10 021105 Ed Exp $ + +.PATH: ${.CURDIR}/../../fs/minixfs +KMOD= minixfs +SRCS= vnode_if.h \ + minix_subr.c minix_vfsops.c minix_vnops.c minix_lookup.c \ + minix_bio.c minix_inode.c minix_ufs.c minix_locks.c \ + minix_ihash.c minix_alock.s +NOMAN= + +.include diff -ruN sys.orig/sys/vnode.h sys/sys/vnode.h --- sys.orig/sys/vnode.h Mon Dec 24 17:44:44 2001 +++ sys/sys/vnode.h Fri Feb 28 13:46:55 2003 @@ -65,7 +65,7 @@ VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_SMBFS + VT_HPFS, VT_NWFS, VT_SMBFS, VT_MINIXFS }; /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Fri Feb 28 22:53:30 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E46D137B401 for ; Fri, 28 Feb 2003 22:50:19 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8218343FAF for ; Fri, 28 Feb 2003 22:50:13 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h216oDNS075039 for ; Fri, 28 Feb 2003 22:50:13 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h216oDkW075038; Fri, 28 Feb 2003 22:50:13 -0800 (PST) Date: Fri, 28 Feb 2003 22:50:13 -0800 (PST) Message-Id: <200303010650.h216oDkW075038@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ed Alley Subject: kern/47982: Minix file-system offered Reply-To: Ed Alley Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/47982; it has been noted by GNATS. From: Ed Alley To: FreeBSD-gnats-submit@freebsd.org Cc: wea@llnl.gov Subject: kern/47982: Minix file-system offered Date: Fri, 28 Feb 2003 22:42:58 -0800 (PST) >Submitter-Id: current-users >Originator: Ed Alley >Organization: Lawrence Livermore National Laboratory >Confidential: no >Synopsis: kern/47982: Minix file-system offered >Severity: non-critical >Priority: low >Category: kern >Class: update >Release: FreeBSD 4.6.2-RELEASE i386 >Environment: System: FreeBSD jordan.llnl.gov FreeBSD 4.6.2-RELEASE #0: i386 >Description: RE: PR kern/47982 This is an update of my previous submission. The previous submitted patch should be discarded. I have added inode hashing, and the ability to operate with data zone sizes that can contain a power of two number of contiguous data blocks. This is supposed to make disk reads a little more efficient in Minix lore, but I put it in for compatability reasons. I have also fixed some bugs that either corrupted the FS or in one case caused a random page-fault. This was traced to the root inode pointer getting trashed when its vnode was released and re-assigned through the vnode cache process. Other bugs occured during renameing of files and directories after a remove has been performed. (Boy! VOPS_RENAME(9) is sure a subtle routine; I worked a long time on that one and am still not 100% sure about it.) >How-To-Repeat: Not applicable >Fix: Rather than submit one huge patch on /usr/src, I have submitted two patches: one for /usr/src/sbin, and one for /usr/src/sys. The patches are demarked by the line: 8><------------------------------------------------- Cut here The sources have been diffed against FreeBSD 4.6.2. To apply the /sbin patch: cd /usr/src patch -p0 < sbin.patch To apply the /kernel patch: cd /usr/src patch -p0 < sys.patch Ed Alley FOLLOWING is the SBIN PATCH: 8><------------------------------------------------- Cut here diff -ruN sbin.orig/Makefile sbin/Makefile --- sbin.orig/Makefile Mon Mar 18 00:40:00 2002 +++ sbin/Makefile Fri Feb 28 13:44:16 2003 @@ -78,7 +78,7 @@ vinum .if ${MACHINE_ARCH} == i386 -SUBDIR+= kget mount_nwfs mount_smbfs +SUBDIR+= kget mount_nwfs mount_smbfs mount_minix newfs_minix .endif .if exists(${.CURDIR}/${MACHINE}) diff -ruN sbin.orig/mount_minix/Makefile sbin/mount_minix/Makefile --- sbin.orig/mount_minix/Makefile Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/Makefile Fri Feb 28 13:54:39 2003 @@ -0,0 +1,10 @@ + +PROG= mount_minixfs +SRCS= mount_minixfs.c getmntopts.c +MAN= mount_minixfs.8 + +MOUNT= ${.CURDIR}/../mount +CFLAGS+= -I${MOUNT} +.PATH: ${MOUNT} + +.include diff -ruN sbin.orig/mount_minix/bsd-copyright sbin/mount_minix/bsd-copyright --- sbin.orig/mount_minix/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/bsd-copyright Fri Feb 28 13:50:57 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sbin.orig/mount_minix/mount_minixfs.8 sbin/mount_minix/mount_minixfs.8 --- sbin.orig/mount_minix/mount_minixfs.8 Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/mount_minixfs.8 Fri Feb 28 13:55:27 2003 @@ -0,0 +1,44 @@ + +.Dd November 5, 2002 +.Dt MOUNT_MINIXFS 8 +.Os +.Sh NAME +.Nm mount_minixfs +.Nd mount a minixfs file system +.Sh SYNOPSIS +.Nm +.Op Fl o Ar options +.Ar special +.Ar node +.Sh DESCRIPTION +The +.Nm +command attaches a minixfs file system +.Ar special +device on to the file system tree at the point +.Ar node . +.Pp +This command is normally executed by +.Xr mount 8 +at boot time. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl o +Options are specified with a +.Fl o +flag followed by a comma separated string of options. +See the +.Xr mount 8 +man page for possible options and their meanings. +.El +.Sh SEE ALSO +.Xr mount 2 , +.Xr unmount 2 , +.Xr fstab 5 , +.Xr mount 8 +.Sh HISTORY +The +.Nm +function first appeared in +.Fx 4.6 . diff -ruN sbin.orig/mount_minix/mount_minixfs.c sbin/mount_minix/mount_minixfs.c --- sbin.orig/mount_minix/mount_minixfs.c Wed Dec 31 16:00:00 1969 +++ sbin/mount_minix/mount_minixfs.c Fri Feb 28 13:52:40 2003 @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "mntopts.h" + +struct mntopt mopts[] = { + MOPT_STDOPTS, + MOPT_FORCE, + MOPT_SYNC, + MOPT_UPDATE, + { NULL } +}; + +static void usage __P((void)) __dead2; + +int +main(argc, argv) + int argc; + char *argv[]; +{ + struct ufs_args args; + int ch, mntflags; + char *fs_name, *options, mntpath[MAXPATHLEN]; + struct vfsconf vfc; + int error; + + options = NULL; + mntflags = 0; + while ((ch = getopt(argc, argv, "o:")) != -1) + switch (ch) { + case 'o': + getmntopts(optarg, mopts, &mntflags, 0); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 2) + usage(); + + args.fspec = argv[0]; /* the name of the device file */ + fs_name = argv[1]; /* the mount point */ + + /* + * Resolve the mountpoint with realpath(3) and remove unnecessary + * slashes from the devicename if there are any. + */ + (void)checkpath(fs_name, mntpath); + (void)rmslashes(args.fspec, args.fspec); + +#define DEFAULT_ROOTUID -2 + args.export.ex_root = DEFAULT_ROOTUID; + if (mntflags & MNT_RDONLY) + args.export.ex_flags = MNT_EXRDONLY; + else + args.export.ex_flags = 0; + + error = getvfsbyname("minixfs", &vfc); + if (error && vfsisloadable("minixfs")) { + if (vfsload("minixfs")) { + err(EX_OSERR, "vfsload(minixfs)"); + } + endvfsent(); /* flush cache */ + error = getvfsbyname("minixfs", &vfc); + } + if (error) + errx(EX_OSERR, "minixfs filesystem is not available"); + + if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0) + err(EX_OSERR, "%s", args.fspec); + exit(0); +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: mount_minixfs [-o options] special node\n"); + exit(EX_USAGE); +} diff -ruN sbin.orig/newfs_minix/Makefile sbin/newfs_minix/Makefile --- sbin.orig/newfs_minix/Makefile Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/Makefile Fri Feb 28 13:44:15 2003 @@ -0,0 +1,32 @@ +# Copyright (c) 2003 Ed Alley: wea@llnl.gov +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +PROG= newfs_minix +SRCS= main.c super.c blockio.c inodeio.c zoneio.c dirio.c misc.c +MAN= newfs_minix.8 + +LINKS= ${BINDIR}/newfs_minix ${BINDIR}/mount_minixfs +MLINKS= newfs_minix.8 mount_minixfs.8 + +.include diff -ruN sbin.orig/newfs_minix/blockio.c sbin/newfs_minix/blockio.c --- sbin.orig/newfs_minix/blockio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/blockio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "mkfs.h" + +#include + +void +insert_bit(block_t block, int bit) +{ + /* Inserts a bit in a bitmap */ + + int w, s; + short buf[BLOCK_SIZE / sizeof(short)]; + + get_block(block, (char*)buf); + + w = bit / (8 * sizeof(short)); + s = bit % (8 * sizeof(short)); + + buf[w] |= (1 << s); + + put_block(block, (char*)buf); +} + +int +read_bit(block_t block, int bit) +{ + /* Returns a bit in a bitmap */ + + int w, s; + short buf[BLOCK_SIZE/sizeof(short)]; + + get_block(block, (char *)buf); + + w = bit / (8 * sizeof(short)); + s = bit % (8 * sizeof(short)); + + return ((int)((buf[w] >> s) & 0x1)); +} + +void +get_block (block_t block, char *buf) +{ + bcopy (zone[block].store, buf, BLOCK_SIZE); +} + +void +put_block (block_t block, char *buf) +{ + bcopy (buf, zone[block].store, BLOCK_SIZE); + +} diff -ruN sbin.orig/newfs_minix/bsd-copyright sbin/newfs_minix/bsd-copyright --- sbin.orig/newfs_minix/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/bsd-copyright Fri Feb 28 13:44:15 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sbin.orig/newfs_minix/dirio.c sbin/newfs_minix/dirio.c --- sbin.orig/newfs_minix/dirio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/dirio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The following code was slightly modified from Minix's mkfs.c with permission. + */ + +#include "mkfs.h" + +void rootdir(mino_t inode) +{ + /* + Get a zone for the root directory and + add the two entries for '.' and '..' + The length of a single directory entry is + 16 bytes; hence, 32 for two directories. + */ + + add_zone(inode, alloc_zone(), 32L, current_time); + + /* + Add the directory entries for the root directory. + (note that the parent and child inodes are the same) + */ + + enter_dir(inode, ".", inode); + enter_dir(inode, "..", inode); + + /* increment the link counts */ + + incr_link(inode); + incr_link(inode); +} + + +void +incr_link(mino_t n) +{ + /* Increment the link count to inode n */ + + int off; + block_t b; + inode_t inode2[V2_INODES_PER_BLOCK]; + + b = ((n - 1) / inodes_per_block) + inode_offset; + off = (n - 1) % inodes_per_block; + + get_block(b, (char *) inode2); + inode2[off].i_nlinks++; + put_block(b, (char *) inode2); +} + +void +enter_dir(mino_t parent, char *name, mino_t child) +{ + /* Enter child in parent directory */ + /* Works for dir > 1 block and zone > block */ + + int i, j, k, l, off; + block_t b; + zone_t z; + char *p1, *p2; + struct direct dir_entry[NR_DIR_ENTRIES]; + inode_t ino2[V2_INODES_PER_BLOCK]; + int nr_dzones; + + b = ((parent - 1) / inodes_per_block) + inode_offset; + off = (parent - 1) % inodes_per_block; + + get_block(b, (char *) ino2); + nr_dzones = V2_NR_DZONES; + + for (k = 0; k < nr_dzones; k++) { + z = ino2[off].i_zone[k]; + if (z == 0) { + z = alloc_zone(); + ino2[off].i_zone[k] = z; + } + for (l = 0; l < zone_size; l++) { + get_block((z << zone_shift) + l, (char *) dir_entry); + for (i = 0; i < NR_DIR_ENTRIES; i++) { + if (dir_entry[i].d_ino == 0) { + dir_entry[i].d_ino = child; + p1 = name; + p2 = dir_entry[i].d_name; + j = 14; + while (j--) { + *p2++ = *p1; + if (*p1 != 0) p1++; + } + put_block((z << zone_shift) + l, (char *) dir_entry); + put_block(b, (char *) ino2); + return; + } + } + } + } + + printf("Directory-inode %d beyond direct blocks. Could not enter %s\n", + parent, name); + exit(1); +} diff -ruN sbin.orig/newfs_minix/inodeio.c sbin/newfs_minix/inodeio.c --- sbin.orig/newfs_minix/inodeio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/inodeio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "mkfs.h" + +/* + Returns a free inode number and marks it active +*/ + +mino_t +get_inode(void) +{ + mino_t num; + block_t inodemap; + int bit; + + /* loop over inodes */ + + for (num=1; num +#include +#include + +int zone_size, zone_map, zone_shift; +int zoff; +int inodes_per_block; +int inode_offset; +int nrblocks, nrnodes; +long current_time; +zone_t nrzones; +unsigned int nrinodes; +Zone_t *zone; +char zero[BLOCK_SIZE]; + +#define MAX_BLOCKS (1024L * 1024) +#define MAX_INODES ((unsigned) 65535) + +void super(super_block_t*, zone_t, mino_t); +void usage(int,char*); + +int +main(int argc, char **argv) +{ + int c, i, s, fdo, no_output; + super_block_t sp[1]; + struct timeval timestr; + int mode; + char *ch, *fname = (char*)NULL; + char defname[] = {"flimage"}; + + /* The following default values are for a 1440K floppy fs */ + + nrblocks = 1440; + nrinodes = 0; + zone_shift = 0; + no_output = 0; + + while(1) { + if ((s = getopt(argc, argv, ":hNi:b:s:")) == -1) { + fname = argv[optind++]; + break; + } + switch (s) { + case 'h': + usage(0,(char*)NULL); + break; + case 'i': + ch = optarg; + for (i=0; i MAX_BLOCKS) + usage(1, "nrblocks greater than (1024 X 1024)"); + + if (nrinodes == 0) { + /* The default for inodes is 3 blocks per inode, rounded up + * to fill an inode block. Above 20M, the average files are + * sure to be larger because it is hard to fill up 20M with + * tiny files, so reduce the default number of inodes. This + * default can always be overridden by using the -i option. + */ + nrinodes = nrblocks / 3; + if (nrblocks >= 20000) nrinodes = nrblocks / 4; + if (nrblocks >= 40000) nrinodes = nrblocks / 5; + if (nrblocks >= 60000) nrinodes = nrblocks / 6; + if (nrblocks >= 80000) nrinodes = nrblocks / 7; + if (nrblocks >= 100000) nrinodes = nrblocks / 8; + nrinodes += inodes_per_block - 1; + nrinodes = nrinodes / inodes_per_block * inodes_per_block; + if (nrinodes > MAX_INODES) nrinodes = MAX_INODES; + } + + if (nrinodes < 1) + usage(1, "Inode count too small"); + + if (nrinodes > MAX_INODES) + usage(1, "Inode count too large"); + + if (fname == NULL && !no_output) { + usage(1, "No special file provided"); + } + + zone_size = BLOCK_SIZE << zone_shift; + nrzones = nrblocks >> zone_shift; + if ((nrzones << zone_shift) < nrblocks) + nrzones++; + + printf("block size = 1024 bytes\n"); + printf("zone size = %d bytes\n",(int)zone_size); + printf("number of blocks = %d\n",(int)nrblocks); + printf("number of zones = %d\n",(int)nrzones); + printf("zone shift = %d\n",(int)zone_shift); + + zone = (Zone_t*)malloc(nrzones*zone_size); + + bzero((char*)zone, nrzones*zone_size); + + gettimeofday(×tr, NULL); + current_time = timestr.tv_sec; /* UNIX time in seconds */ + + /* Set up a block of zeros */ + + bzero(zero, BLOCK_SIZE); + + /* Set up the superblock */ + + super(sp, nrzones, nrinodes); + + /* The superblock goes into block[1]. */ + + zone[1].sp = sp[0]; + + zone_map = INODE_MAP + sp->s_imap_blocks; + zone_size = 1 << zone_shift; /* Re-define zone_size */ + zoff = sp->s_firstdatazone - 1; + + insert_bit(INODE_MAP, 0); /* inode zero is not used but must be allocated */ + insert_bit(zone_map, 0); /* bit zero must always be allocated in zone map */ + + /* + Set the mode and rwx bits for the root directory + */ + + mode = 040755; /* drwxr_xr_x */ + + rootdir(alloc_inode(mode, getuid(), getgid())); + + if (!no_output) { + + if ((fdo = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) { + printf("Can't open file: %s; Quitting!\n",fname); + exit(1); + } + + /* Write out the blocks */ + + for (i=0; i> BITMAPSHIFT + * + * doesn't work because of overflow. + * + * Other overflow bugs, such as the expression for N_ILIST overflowing when + * s_inodes is just over INODES_PER_BLOCK less than the maximum+1, are not + * fixed yet, because that number of inodes is silly. + */ + +/* The above comment doesn't all apply now bit_t is ulong. Overflow is now + * unlikely, but negative bit counts are now possible (though unlikely) + * and give silly results. + */ + +int +bitmapsize(bit_t nr_bits) +{ + int nr_blocks; + + nr_blocks = (int) (nr_bits >> BITMAPSHIFT); + + if (((bit_t) nr_blocks << BITMAPSHIFT) < nr_bits) + ++nr_blocks; + + return nr_blocks; +} diff -ruN sbin.orig/newfs_minix/mkfs.h sbin/newfs_minix/mkfs.h --- sbin.orig/newfs_minix/mkfs.h Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/mkfs.h Fri Feb 28 13:44:15 2003 @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + /*************************************************************************** + * * + * Minix File System * + * * + * The guide for these sources comes from Andrew Tannenbaum's MINIX * + * source which can be gotten from the official MINIX home page: * + * http://www.cs.vu.nl/~ast/minix.html * + * Some of the names have been changed to avoid conflicts with FBSD. ;) * + * * + * For further information there is also the book: * + * Tannenbaum and Woodhull, * + * "Operating Systems Design and Implememtation", 2nd ed, 1997 * + * from Prentice Hall, New Jersey * + * * + ****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include + +/* + * In the definitions that follow, a zone is a block. + * There exists the possiblity that a zone can be + * a power of two larger than a block; that is the + * function of the variable s_log_zone_size in the + * super block which represents the shift needed + * to go from blocks to zones and back again. + */ + +#define BLOCK_SIZE 1024 /* # bytes in a disk block */ + +#define BITS_PER_BLOCK 8192 /* 8*BLOCK_SIZE */ +#define BITMAPSHIFT 13 /* log2(BITS_PER_BLOCK) */ + +#define INODE_MAP 2 /* position of first inode bitmap */ + +#define V2_NR_DZONES 7 +#define V2_NR_TZONES 10 +#define NR_INODES 64 +#define V2_INODE_SIZE 64 /* sizeof(inode_t) */ +#define V2_ZONE_NUM_SIZE 4 /* sizeof(zone_t) = 32 bits */ +#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE) +#define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /* # zones/indir block */ + +/* The type of sizeof may be (unsigned) long. Use the following macro for + * taking the sizes of small objects so that there are no surprises like + * (small) long constants being passed to routines expecting an int. + */ + +#define usizeof(t) ((unsigned) sizeof(t)) + +/* Types used in disk, inode, etc. data structures. */ +typedef unsigned short mino_t; /* i-node number */ +typedef unsigned short mmode_t; /* file type and permissions bits */ +typedef unsigned long moff_t; /* offset within a file */ +typedef unsigned short zone1_t; /* zone number for V1 file systems */ +typedef unsigned long zone_t; /* zone number */ +typedef unsigned long block_t; /* block number */ +typedef unsigned long bit_t; /* bit number in a bitmap */ +typedef unsigned short bitchunk_t; /* a collection of bits from a bitmap */ +typedef long mtime_t; /* time in sec since 1 Jan 1970 0000 GMT */ + +/* File system types. */ +#define SUPER_MAGIC 0x137F /* magic number contained in super-block */ +#define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */ +#define SUPER_V2 0x2468 /* magic # for V2 file systems */ +#define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */ + +/* Directory layout */ +#define DIRBLKSIZ 512 +#define DIRSIZ 14 + +struct direct { + mino_t d_ino; /* 2 */ + char d_name[DIRSIZ]; /* 14 */ +}; + +#define DIR_ENTRY_SIZE usizeof(struct direct) +#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) + +/* Structure of the superblock on disk */ + +typedef struct { + mino_t s_ninodes; /* # usable inodes on the minor device */ + zone1_t s_nzones; /* total device size, including bit maps etc */ + short s_imap_blocks; /* # of blocks used by inode bit map */ + short s_zmap_blocks; /* # of blocks used by zone bit map */ + zone1_t s_firstdatazone; /* number of first data zone */ + short s_log_zone_size; /* log2 of blocks/zone */ + moff_t s_max_size; /* maximum file size on this device */ + short s_magic; /* magic number to recognize super-blocks */ + short s_pad; /* try to avoid compiler-dependent padding */ + zone_t s_zones; /* number of zones (replaces s_nzones in V2) */ + char pad[1000]; /* pad the block to 1024 bytes */ +} super_block_t; + +/* Structure of an inode on disk. length = 64 bytes. */ + +typedef struct { + mmode_t i_mode; /* file type, protection, etc. 2 */ + short i_nlinks; /* how many links to this file 2 */ + short i_uid; /* user id of the file's owner 2 */ + short i_gid; /* group number 2 */ + moff_t i_size; /* current file size in bytes 4 */ + mtime_t i_atime; /* time of last access (V2 only) 4 */ + mtime_t i_mtime; /* when was file data last changed 4 */ + mtime_t i_ctime; /* when was inode itself changed (V2 only) 4 */ + zone_t i_zone[V2_NR_TZONES]; /* zone numbers for direct, ind, and dbl ind 40 */ +} inode_t; + +/* A zone can be inodes, a bootblock, a superblock or data */ +/* This definition really defines the possible structure of a block */ + +typedef union { + inode_t inode[16]; + super_block_t sp; + struct boot_block_s { + char bootblock[294]; + char pad[730]; + } boot_block; + char store[1024]; +} Zone_t; + +void insert_bit (block_t, int); +int read_bit (block_t, int); +mino_t get_inode(void); +void get_block (block_t, char*); +void put_block (block_t, char*); +void rootdir(mino_t); +zone_t alloc_zone(void); +mino_t alloc_inode(int , int, int); +void add_zone(mino_t, zone_t, long, long); +void incr_link(mino_t); +void enter_dir(mino_t, char*, mino_t); + +/* These variable are defined in main and used throughout */ + +extern Zone_t *zone; +extern int zone_size, zone_map, zone_shift; +extern int zoff; +extern char zero[BLOCK_SIZE]; +extern int inodes_per_block; +extern int inode_offset; +extern int nrblocks, nrnodes; +extern long current_time; +extern zone_t nrzones; +extern unsigned int nrinodes; diff -ruN sbin.orig/newfs_minix/newfs_minix.8 sbin/newfs_minix/newfs_minix.8 --- sbin.orig/newfs_minix/newfs_minix.8 Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/newfs_minix.8 Fri Feb 28 13:56:11 2003 @@ -0,0 +1,59 @@ + +.Dd February 28, 2003 +.Dt NEWFS_MINIX 8 +.Os +.Sh NAME +.Nm newfs_minix +.Nd construct a new Minix file system +.Sh SYNOPSIS +.Nm +.Op Fl N +.Op Fl b Ar number-of-blocks +.Op Fl i Ar number-of-inodes +.Op Fl s Ar zone-shift +.Ar special +.Sh DESCRIPTION +The +.Nm +utility is used to initialize and clear the Minix +filesystem on device +.Ar special. +(We often refer to the +.Dq special file +as the +.Dq disk , +although the special file need not be a physical disk. +In fact, it need not even be special.) +Without options +.Nm +will make a file system that will fit on a 1.44MB +floppy disk, however, +.Nm +has some options to allow the defaults to be selectively overridden. +.Pp +The following options define the general layout policies: +.Bl -tag -width indent +.It Fl b Ar number-of-blocks +The total number of blocks of 1024 bytes each that the FS will contain. +If this option is not provided then 1440 blocks are chosen. +.It Fl i Ar number-of-inodes +The number of inode in the FS. If this option is not provided then +the number of inodes will be calculated to be roughly 1/3 of the +number of blocks. +.It Fl s Ar zone-shift +The log2 of the number of blocks/zone. The FS can be designed to be +made up of data zones that contain a power of two contiguous blocks +in them. The default for this parameter is zero. +.It Fl N +Cause the file system parameters to be printed out +without really creating the file system. +.Sh SEE ALSO +.Xr mount 8 , +.Xr mount_minixfs 8 +.Sh AUTHOR +.An Ed Alley +.Sh HISTORY +The +.Nm +command first appeared in +.Bx 4.6.2 . diff -ruN sbin.orig/newfs_minix/super.c sbin/newfs_minix/super.c --- sbin.orig/newfs_minix/super.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/super.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* The following code was lifted and modified from the minix source with permission. */ + +#include "mkfs.h" + +int bitmapsize(bit_t); + +void +super(super_block_t *sp, zone_t nzones, mino_t ninodes) +{ + zone_t maxsize; + zone_t fstblk, fstzon; + short impsize, zmpsize; + int i, inoblks; + + /* + The maximum file size is the cube of the number of indirects + plus the square of the number of indirects plus the number of + indirects plus the number of direct entries in the inode times + the number of bytes in a zone. This can be a very large number, + (more than 32 bits of addressing can manage). + */ + + /* With triple indirects just put the 2GB limit as the max size */ + + maxsize = ~(1 << 31); /* All bits are ones except the sign bit */ + + /* maxsize is then (2^31 - 1) = 2,147,483,647 bytes */ + + /* + bitmapsize() returns the number of blocks in a bitmap + */ + + impsize = bitmapsize((bit_t) (1 + ninodes)); + zmpsize = bitmapsize((bit_t) nzones); + + printf("blocks in imap = %d\n",impsize); + printf("blocks in zmap = %d\n",zmpsize); + + /* + The number of blocks to the beginning of the inodes + */ + + inode_offset = impsize + zmpsize + 2; + + printf("inode offset = %d\n", inode_offset); + + /* The number blocks that contain inodes */ + + inoblks = (ninodes + inodes_per_block - 1)/inodes_per_block; + + printf("inode blocks = %d\n",inoblks); + + /* + The number of blocks to the beginning of the data + gives the location of the first data zone. + */ + + fstblk = inode_offset + inoblks; /* Number of 1K blocks */ + fstzon = (fstblk + (1 << zone_shift) - 1) >> zone_shift; + + printf("first data zone = %d\n",(int)fstzon); + printf("first data block = %d\n",(int)(fstzon << zone_shift)); + + /* + Construct the V2 superblock + */ + + sp->s_ninodes = ninodes; /* # of inodes */ + sp->s_nzones = 0; /* Not used in V1; forces errors in V2 */ + sp->s_imap_blocks = impsize; /* # of blocks used by inode bit map */ + sp->s_zmap_blocks = zmpsize; /* # of blocks used by zone bit map */ + sp->s_firstdatazone = fstzon; /* index of the first data zone */ + sp->s_log_zone_size = zone_shift; /* log2(blocks/zone) */ + sp->s_max_size = maxsize; /* Maximum file system size */ + sp->s_magic = SUPER_V2; /* Indicates a V2 filesystem */ + sp->s_pad = 0; /* Just padding */ + sp->s_zones = nzones; /* # of zones */ + for (i=0; i<1000; i++) /* Pad the rest of the block with zeros */ + sp->pad[i] = '\0'; +} diff -ruN sbin.orig/newfs_minix/zoneio.c sbin/newfs_minix/zoneio.c --- sbin.orig/newfs_minix/zoneio.c Wed Dec 31 16:00:00 1969 +++ sbin/newfs_minix/zoneio.c Fri Feb 28 13:44:15 2003 @@ -0,0 +1,127 @@ +/*- + * Copyright (c) 2003 Ed Alley + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The code below was lifted from Minix's mkfs.c with permission. + */ + +#include "mkfs.h" + +/* + * Returns a free zone/block number and marks it active + */ + +zone_t +get_zone(void) +{ + zone_t num; + block_t znodemap; + int bit; + + /* loop over zones */ + + for (num=1; num block */ + + block_t b; + int i; + zone_t z; + + /* Get a free zone/block and mark it active */ + + z = get_zone(); + + b = z << zone_shift; + + for (i = 0; i < zone_size; i++) + put_block(b + i, zero); /* give an empty zone */ + + return z; /* Returns the absolute zone number in the file */ +} + +void +add_zone(mino_t n, zone_t z, long bytes, long cur_time) +{ + /* Add zone z to inode n. The file has grown by 'bytes' bytes. */ + + int off, i; + block_t b; + zone_t indir; + zone_t blk[V2_INDIRECTS]; + inode_t *p; + inode_t inode[V2_INODES_PER_BLOCK]; + + b = ((n - 1) / V2_INODES_PER_BLOCK) + inode_offset; + off = (n - 1) % V2_INODES_PER_BLOCK; + + get_block(b, (char *) inode); + p = &inode[off]; + p->i_size += bytes; + p->i_mtime = cur_time; + for (i = 0; i < V2_NR_DZONES; i++) + if (p->i_zone[i] == 0) { + p->i_zone[i] = z; + put_block(b, (char *) inode); + return; + } + put_block(b, (char *) inode); + + /* File has grown beyond a small file. */ + + if (p->i_zone[V2_NR_DZONES] == 0) p->i_zone[V2_NR_DZONES] = alloc_zone(); + indir = p->i_zone[V2_NR_DZONES]; + put_block(b, (char *) inode); + b = indir << zone_shift; + get_block(b, (char *) blk); + for (i = 0; i < V2_INDIRECTS; i++) + if (blk[i] == 0) { + blk[i] = z; + put_block(b, (char *) blk); + return; + } + printf("File has grown beyond single indirect"); + exit(1); +} 8><------------------------------------------------- Cut here FOLLOWING is the SYS PATCH: 8><------------------------------------------------- Cut here diff -ruN sys.orig/fs/minixfs/README sys/fs/minixfs/README --- sys.orig/fs/minixfs/README Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/README Fri Feb 28 16:02:15 2003 @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +This is the Minix FS. It was developed on FreeBSD-4.6.x. + +The fs should be located in: "/usr/src/sys/fs/minixfs". There are two other source +files located in /usr/src/sbin/: mount_minixfs(8) is located in the directory: +"mount_minix"; and newfs_minix(8) is located in the directory: newfs_minix. The first +source is needed to mount the FS and the second one will make the FS. The include file: +vnode.h in "/usr/src/sys/sys" is modified in the enum vtagtype statement to include +VT_MINIXFS after the last entry (which at this writing is: VT_SMBFS). The Makefile for +the Minix FS is located in: "/usr/src/sys/modules/minixfs". The Makefile for sbin must +be modified to compile minix_mountfs.c and newfs_minix.c. The Makefile for the modules +must be modified to compile the Minix FS module. I modified the i386 sections of these +Makefiles because the FS only works on the i386 platform. + + Ed diff -ruN sys.orig/fs/minixfs/TODO sys/fs/minixfs/TODO --- sys.orig/fs/minixfs/TODO Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/TODO Fri Feb 28 16:28:01 2003 @@ -0,0 +1,69 @@ +To do list: (Not necessarily in order of importance) + + 1. Modify to allow zone sizes larger than one block. + As of now: zone size = block size = 1024 bytes. + The routine: minix_bmapfs() shows a beginning + in that direction. There is an issue of whether + to save the zone fragments after reading, in case + another block is desired within a previously read + zone. I realize that these issues have already + been delt with in ufs and ext2fs and that these + algorithms should be understood before writing one + for Minix. + (DONE 030213 by Ed Alley) + + 2. Fix ip hashing. + As of now I get a panic (page fault from memory manager) + after a dismount then subsequent remount; the panic + occurs when I first reference the file system after + the remount, for example, by executing ls(1) within + the file system. Because of this I have disabled ip hashing + in this source until I can figure out what is going wrong. + (DONE 030228 by Ed Alley) + + 3. Clean up redundant metadata writes. + This involves reducing the number of 'minix_update()' calls + to a minimum when metadata changes occur; I took a very + conservative approach in building this fs and did not + even consider trying to design it with asynchronous updates + of metadata; as a consequence, there are undoubtably too + many update() calls. + + 4. Make more routines static. + Need to reduce the number of routines with prototypes + lacking the "static" designation to reduce the number + of minix functions with global names. + + 5. Write a minix_fsck routine. + Probably not necessary, because Minix already has one + operating on its side of the fence. But it might be + fun nonetheless. :) + + 6. Make modifications for other platforms. + As of now the Minix fs only works on the i386 platform. + This might be tricky if endian issues are involved. + + 7. Write a newfs_minix routine. + (DONE 030210 by Ed Alley) + + 8. Page fault if module is loaded for days! + I don't understand this one. It seems that + the module will page fault if it is loaded + for days even after being unmounted. If a + fs is mounted, then a page fault will occur. + This can be eliminated by unloading the + module after the last fs is unmounted. + (DONE 020220 by Ed Alley) + + 9. Clean up the directory manipulating routines: + Come up with a way to keep track of holes, + so we don't have to search the directory + each time we need to put an entry in. + Also, fix up the way that the directory + size is determined: right now we just count + the entries until the last is found. + Fix up the way directories are truncated + when they are shortened: right now we just + copy out the existing entries, clean the + directory out and then reload it with the + saved entries. diff -ruN sys.orig/fs/minixfs/bsd-copyright sys/fs/minixfs/bsd-copyright --- sys.orig/fs/minixfs/bsd-copyright Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/bsd-copyright Fri Feb 28 13:46:38 2003 @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff -ruN sys.orig/fs/minixfs/minix.h sys/fs/minixfs/minix.h --- sys.orig/fs/minixfs/minix.h Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix.h Fri Feb 28 21:07:27 2003 @@ -0,0 +1,373 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/**************************************************************************** + * * + * Minix File System include file * + * * + * The guide for this include file comes from Andrew Tannenbaum's MINIX * + * source which can be gotten from the official MINIX home page: * + * http://www.cs.vu.nl/~ast/minix.html * + * Some of the names have been changed to avoid conflicts with FBSD. ;) * + * * + * For further information there is also the book: * + * Tannenbaum and Woodhull, * + * "Operating Systems Design and Implememtation", 2nd ed, 1997 * + * from Prentice Hall, New Jersey * + * * + ****************************************************************************/ + +#ifndef _SYS_PARAM_H_ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifndef _SYS_MALLOC_H_ +#include +#endif + +#define MINIXFS_VERSION 2 /* Version 2 Minix file system */ + /* Block size = 1024 bytes. */ + +/* Some maximum sizes */ + +#define MINIX_NAME_MAX 14 /* Max size of a file name */ +#define MINIX_LINK_MAX 127 /* Max links of a file */ +#define MINIX_PATH_MAX 255 /* Maximum path length */ +#define MINIX_PIPE_BUF 512 /* Maximum size of atomic pipe writes */ + +/* Block size defines */ + +#define NO_BLOCK 0 /* Flag indicating no block available */ +#define NO_ZONE 0 /* Flag indicating no zone available */ +#define BLOCK_SIZE 1024 /* # bytes in a disk block */ +#define BITCHUNK_SIZE 2 /* # bytes in a bitchunk */ +#define BITMAP_CHUNKS 512 /* # bitmap chunks in a disk block */ +#define BITCHUNK_BITS 16 /* # bits in a bitchunk */ +#define BITS_PER_BLOCK 8192 /* # bits in a block 8*BLOCK_SIZE */ +#define BITMAPSHIFT 13 /* log2(BITS_PER_BLOCK) */ + +/* Inode defines */ + +#define ROOT_INO 1 /* Minix uses inode 1 for the root inode */ +#define NO_INODE 0 /* Inode number to return if none found */ +#define V2_INODE_SIZE 64 /* size of inode in bytes */ +#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE) /* # of inodes per block */ +#define INODE_MAP 2 /* position of first inode bitmap in file */ +#define V2_NR_DBLOCKS 7 /* # of direct block pointers in inode */ +#define V2_NR_TBLOCKS 10 /* # of block pointers: direct+single+double+triple */ +#define V2_NR_INDIRECTS 256 /* # of indirect pointers in a block */ +#define INDIRECT_SHIFT 8 /* log2(V2_NR_INDIRECTS) */ + +/* These next defines count the number of addressable blocks */ + +#define NR_DIRECT V2_NR_DBLOCKS +#define NR_SINDIRECT V2_NR_INDIRECTS +#define NR_DINDIRECT (V2_NR_INDIRECTS*NR_SINDIRECT) +#define NR_TINDIRECT (V2_NR_INDIRECTS*NR_DINDIRECT) + +#define TOT_DIRECT NR_DIRECT +#define TOT_SINDIRECT (TOT_DIRECT + NR_SINDIRECT) +#define TOT_DINDIRECT (TOT_SINDIRECT + NR_DINDIRECT) +#define TOT_TINDIRECT (TOT_DINDIRECT + NR_TINDIRECT) + +/* Minix flag bits for i_mode in the dinode. */ + +#define I_TYPE 0170000 /* this field gives inode type */ +#define I_SOCK 0140000 /* UNIX domain socket */ +#define I_LINK 0120000 /* symbolic link */ +#define I_REGULAR 0100000 /* regular file, not dir or special */ +#define I_BLOCK_SPECIAL 0060000 /* block special file */ +#define I_DIRECTORY 0040000 /* file is a directory */ +#define I_CHAR_SPECIAL 0020000 /* character special file */ +#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */ +#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */ +#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */ +#define ALL_MODES 0006777 /* all bits for user, group and others */ +#define RWX_MODES 0000777 /* mode bits for RWX only */ +#define R_BIT 0000004 /* Rwx protection bit */ +#define W_BIT 0000002 /* rWx protection bit */ +#define X_BIT 0000001 /* rwX protection bit */ +#define I_NOT_ALLOC 0000000 /* this inode is free */ + +/* Block defines */ + +#define V2_BLOCK_NUM_SIZE 4 /* size of block address in bytes */ +#define V2_INDIRECTS (BLOCK_SIZE/V2_BLOCK_NUM_SIZE) /* # blocks per indir block */ + +/* File system types. (Only SUPER_V2 is recognized in this implementation */ + +#define SUPER_MAGIC 0x137F /* magic number contained in super-block */ +#define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */ +#define SUPER_V2 0x2468 /* magic # for V2 file systems */ +#define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */ + +/* The type of sizeof may be (unsigned) long. Use the following macro for + * taking the sizes of small objects so that there are no surprises like + * (small) long constants being passed to routines expecting an int. + */ + +#define usizeof(t) ((unsigned) sizeof(t)) + +/* Types used in disk, inode, etc. data structures. */ + +typedef u_int16_t mino_t; /* Minix i-node number is 16 bits */ +typedef u_int32_t block_t; /* block number */ +typedef u_int32_t bit_t; /* bit number in a bitmap */ +typedef u_int16_t bitchunk_t; /* a collection of bits from a bitmap */ +typedef long mtime_t; /* time in sec since 1 Jan 1970 0000 GMT */ + +/* Directory layout (Minix only allows 14 characters in a file name) */ + +struct minix_direct { + u_int16_t d_ino; /* 2 */ + char d_name[MINIX_NAME_MAX]; /* 14 */ +}; + +struct minix_dirtemplate { /* 32 bytes */ + u_int16_t dot_ino; + char dot_name[MINIX_NAME_MAX]; + u_int16_t dotdot_ino; + char dotdot_name[MINIX_NAME_MAX]; +}; + +#define DIR_ENTRY_SIZE usizeof(struct minix_direct) /* size of dir entry in bytes = 16 */ +#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /* # of dirs/block = 64 */ +#define MAX_DIR_ENTRIES ((V2_NR_DBLOCKS + V2_NR_INDIRECTS) * NR_DIR_ENTRIES) + +#define MINIX_LINK_MAX 127 /* Maximum number of file links */ +#define MINIX_MAXSYMLINKLEN (4*V2_NR_TBLOCKS) /* Max chars in a short symlink */ +#define MINIX_MAXSYMLINK BLOCK_SIZE /* Max chars in a long symlink */ + +/* Structure of an inode on disk. length = 64 bytes. */ + +struct minix_dinode { + u_int16_t i_mode; /* file type, protection, etc. 2b */ + int16_t i_nlinks; /* how many links to this file 2b */ + int16_t i_uid; /* user id of the file's owner 2b */ + int16_t i_gid; /* group number 2b */ + u_int32_t i_size; /* current file size in bytes 4b */ + int32_t i_atime; /* time of last access (V2 only) 4b */ + int32_t i_mtime; /* when was file data last changed 4b */ + int32_t i_ctime; /* when was inode itself changed (V2 only) 4b */ + u_int32_t i_block[V2_NR_TBLOCKS]; /* direct,+ 1,2,3 indirect 40b */ +}; + +/* Structure of an in-core inode. */ + +struct minix_inode { + struct lock i_lock; /* Inode lock. Must be first. */ + LIST_ENTRY(minix_inode) i_hash; /* Hash chain */ + struct minixmount *i_mmp; + struct vnode *i_vnode; /* Vnode associated with this inode */ + mode_t i_mode; /* BSD style mode of file */ + u_int32_t i_flag; /* flags */ + u_int32_t i_blocks; /* Total number of blocks in file */ + dev_t i_dev; /* specinfo for device associated with this inode */ + ino_t i_number; /* The identity of this inode */ + ino_t i_parent; /* The parent inode */ + int i_count; /* Reference count */ + int i_entry; /* Directory entry number from namei */ + int i_noent; /* First no entry number if a directory */ + struct minix_super_block *i_su; /* Super block */ + struct minix_dinode i_dino; /* The on-disk inode */ +}; + +/* Some useful defines */ + +#define i_nlink i_dino.i_nlinks +#define i_zone i_dino.i_block +#define i_shortlink i_dino.i_block +#define i_rdev i_dino.i_block[0] + +#define ino_to_byte(fs,ino) ((fs->s_firstinode + (ino-1)/V2_INODES_PER_BLOCK)*BLOCK_SIZE) +#define blk_to_byte(blk) ((blk)*BLOCK_SIZE) +#define byte_to_blkn(byte) ((u_daddr_t)((byte) >> DEV_BSHIFT)) +#define ino_off(ino) (((ino-1) % V2_INODES_PER_BLOCK) * V2_INODE_SIZE) +#define VTOMI(vp) ((struct minix_inode*)(vp)->v_data) + +/* These flags are kept in i_flag. (some are not recognized by Minix) */ +#define IN_ACCESS 0x0001 /* Access time update request. */ +#define IN_CHANGE 0x0002 /* Inode change time update request. */ +#define IN_UPDATE 0x0004 /* Modification time update request. */ +#define IN_MODIFIED 0x0008 /* Inode has been modified. */ +#define IN_RENAME 0x0010 /* Inode is being renamed. */ +#define IN_SHLOCK 0x0020 /* File has shared lock. */ +#define IN_EXLOCK 0x0040 /* File has exclusive lock. */ +#define IN_HASHED 0x0080 /* Inode is on hash list */ +#define IN_LAZYMOD 0x0100 /* Modified, but don't write yet. */ + +/* These are the BSD-type mode bits present in the incore inode */ + +/* File permissions. */ +#define IEXEC 0000100 /* Executable. */ +#define IWRITE 0000200 /* Writeable. */ +#define IREAD 0000400 /* Readable. */ +#define ISVTX 0001000 /* Sticky bit. */ +#define ISGID 0002000 /* Set-gid. */ +#define ISUID 0004000 /* Set-uid. */ + +/* File types. */ +#define IFMT 0170000 /* Mask of file type. */ +#define IFIFO 0010000 /* Named pipe (fifo). */ +#define IFCHR 0020000 /* Character device. */ +#define IFDIR 0040000 /* Directory file. */ +#define IFBLK 0060000 /* Block device. */ +#define IFREG 0100000 /* Regular file. */ +#define IFLNK 0120000 /* Symbolic link. */ +#define IFSOCK 0140000 /* UNIX domain socket. */ +#define IFWHT 0160000 /* Whiteout. */ + +#define LSUPER_V2 BLOCK_SIZE /* Byte location of V2 super block on disk */ +#define LSV2BLOCK ((u_daddr_t)(LSUPER_V2/DEV_BSIZE)) /* Record count on device */ + +/* Structure of the superblock length on disk is 24b */ + +struct minix_super_block { + u_short s_ninodes; /* # usable inodes on the minor device 2b */ + u_short s_nzones; /* number of V1 fs zones 2b */ + short s_imap_blocks; /* # of blocks used by inode bit map 2b */ + short s_zmap_blocks; /* # of blocks used by zone bit map 2b */ + u_short s_firstdatazone; /* number of first data zone 2b */ + short s_zshift; /* log2 of blocks/zone 2b */ + u_long s_max_size; /* maximum file size on this device 4b */ + short s_magic; /* magic number 2b */ + short s_pad; /* pad it to a 4-byte boundary 2b */ + u_long s_zones; /* number of V2 fs zones 4b */ + + /* The rest of the structure belongs to the in-core superblock */ + + struct vnode *s_devvp; /* Vnode of device mounted on */ + struct minix_inode *s_root; /* Inode for root dir of mounted file system */ + ino_t s_imnton; /* UFS inode number mounted on */ + u_int16_t *s_ibmap; /* Inode bit-map */ + u_int16_t *s_zbmap; /* Zone bit-map */ + u_int32_t imap_lock; /* Inode bit-map lock variable */ + u_int32_t zmap_lock; /* Zone bit-map lock variable */ + dev_t s_dev; /* Specinfo of device of mounted filesystem */ + int s_rdonly; /* Read only flag */ + int s_version; /* Version number of file system */ + int s_firstinode; /* Block no of first inode */ + int s_zoff; /* Data block offset = s_firstdatazone - 1. */ + int s_bsize; /* Block size */ + int s_zsize; /* Zone size */ +}; + +/* A block can be inodes, directories, a bootblock, a superblock or ... */ + +union minix_block { + struct minix_dinode dinode[16]; /* 16 dinodes */ + struct minix_super_block sp; /* 1 superblock + space */ + struct boot_block_s { /* 1 bootblock + space */ + char bootblock[294]; + char pad[730]; + } boot_block; + struct minix_direct dir[64]; /* 64 directories */ + u_int32_t ind[256]; /* 256 indirect blocks */ + u_int16_t bitchunk[512]; /* 512 bitchunks */ + u_int8_t data[1024]; /* 1024 bytes */ +}; + +#define MBLOCK(bp) ((union minix_block*)((bp)->b_data)) + +struct minixmount { + struct minix_super_block *mnx_su; /* Superblock */ + struct mount *mnx_mp; /* VFS mount structure */ + struct vnode *mnx_devvp; /* Device vnode mounted on */ + dev_t mnx_dev; /* Specinfo of device */ + struct malloc_type *mnx_malloctype; +}; + +/* Inode hash routines */ + +void minix_ihashinit(void); +void minix_ihashuninit(void); +struct vnode *minix_ihashlookup(dev_t, ino_t); +struct vnode *minix_ihashget(dev_t, ino_t); +void minix_ihashins(struct minix_inode *); +void minix_ihashrem(struct minix_inode *); + +/* Support routine prototypes */ + +int minix_vinit(struct mount*, vop_t**, vop_t**, struct vnode**); +int minix_vget(struct mount*, ino_t, struct vnode**); +int minix_vfree(struct vnode*, ino_t, int); +int minix_getblk(struct vnode*,block_t,struct buf**); +int minix_putblk(struct buf*); +void minix_freeblk(struct buf*); +int minix_valloc(struct vnode*,int,struct ucred*, struct vnode**); +int minix_balloc(struct vnode*,u_daddr_t,struct buf**); +int minix_blkatoff(struct vnode*,off_t,char**,struct buf**); +int minix_zalloc(struct minix_super_block*,u_daddr_t*,u_daddr_t*); +int minix_dzalloc(struct minix_super_block*,u_daddr_t); +int minix_makeinode(int,struct vnode*,struct vnode**,struct componentname*); +int minix_addzone(struct minix_inode*,u_daddr_t,u_daddr_t); +int minix_ialloc(struct minix_super_block*,int*); +int minix_dialloc(struct minix_super_block*,int); +int minix_update(struct vnode*); +void minix_itimes(struct vnode*); +int minix_truncate(struct vnode*,off_t,int,struct ucred*,struct proc*); +int minix_iget(struct vnode*,struct minix_super_block*, + mino_t,struct minix_inode*); +int minix_iput(struct minix_inode*); +void minix_wipe_dinode(struct minix_dinode*); +int minix_dinode_access(struct minix_dinode*,int, + struct ucred*,struct minix_super_block*); +int minix_free_inode_count(struct minix_super_block*); +int minix_free_zone_count(struct minix_super_block*); +int minix_next_free_inode(struct minix_super_block*); +int minix_next_free_zone(struct minix_super_block*); +int minix_bmapfs(struct vnode*,u_daddr_t,u_daddr_t*,int*); +int minix_get_vtype(struct minix_inode*); +int minix_num_blocks(u_int16_t, u_int32_t, short); +void minix_get_lock(u_int32_t*); +void minix_free_lock(u_int32_t*); +void minix_makedirentry(struct minix_inode*,struct componentname*, + struct minix_direct*); +int minix_direnter(struct vnode*,struct vnode*,struct minix_direct*, + struct componentname*); +int minix_dirremove(struct vnode*); +int minix_dirempty(struct minix_inode*,ino_t,struct ucred*); +int minix_dirrewrite(struct minix_inode*,struct minix_inode*,ino_t,int); +int minix_checkpath(struct minix_inode*,struct minix_inode*,struct ucred*); + +/* VOP pointers */ + +extern vop_t **minix_vnodeop_p; +extern vop_t **minix_specop_p; +extern vop_t **minix_fifoop_p; + +/* Misc declarations */ + +MALLOC_DECLARE(M_MINIXMNT); +MALLOC_DECLARE(M_MINIXNOD); diff -ruN sys.orig/fs/minixfs/minix_alock.s sys/fs/minixfs/minix_alock.s --- sys.orig/fs/minixfs/minix_alock.s Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_alock.s Fri Feb 28 13:46:38 2003 @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + /************************************************************* + * * + * OK so we have another TSL lock routine. * + * * + * C-Prototype: (long) _alock(long*); * + * * + * I am not spin waiting here because I want the choice * + * of either spin waiting or giving up the processor. * + * This we can do by putting the call to this routine * + * in the argument of a while loop. The loop can either * + * spin or call a cpu giveup routine until the lock is * + * obtained: * + * while (_minix_alock(&lock_var)) { * + * tsleep(&loc_var); * + * } * + * * + * See the file: minix_locks.c, for the implementation. * + * * + *************************************************************/ + +.globl _minix_alock +.align 16 +_minix_alock: + pushl %ebp + movl %esp, %ebp + + pushl %ecx + + movl 8(%ebp), %ecx + movl $1, %eax + + lock xchg (%ecx), %eax + + popl %ecx + + popl %ebp + ret diff -ruN sys.orig/fs/minixfs/minix_bio.c sys/fs/minixfs/minix_bio.c --- sys.orig/fs/minixfs/minix_bio.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_bio.c Fri Feb 28 21:27:15 2003 @@ -0,0 +1,732 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_read_zbit(struct minix_super_block*,u_int32_t); +void minix_write_zbit(struct minix_super_block*,u_int32_t); +void minix_delete_zbit(struct minix_super_block*,u_int32_t); + +/* + * Allocate new blocks from lbof0+1 to lbof1. + * If lbof0 doesn't exist, then allocate it first. + */ +int +minix_balloc(struct vnode *vp, u_daddr_t lbof1, struct buf **bpp) +{ + struct buf *bp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lbof0, lbn, pbn, lb, zone, boff, z0, z1, bsize; + int error; + + *bpp = NULL; + + if (dip->i_size == 0) { /* No zones so create a new one */ + zone = 0; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) + return error; + if ((error = bread(devvp, pbn, sp->s_zsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)sp->s_zsize); + bwrite(bp); + } + + if (dip->i_size > 0) + lbof0 = (dip->i_size - 1)/BLOCK_SIZE; + else + lbof0 = 0; + + z0 = lbof0 >> sp->s_zshift; + z1 = lbof1 >> sp->s_zshift; + + if (z1 <= z0) { /* Zone already exists! just return the block */ + if ((error = minix_bmapfs(vp, lbof1, &pbn, NULL)) != 0) + return error; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)BLOCK_SIZE); + *bpp = bp; + return 0; + } + + /* The new zone extends beyond the file */ + + /* Allocate all the blocks between lbof0 and lbof1 and zero them out */ + + for (lb=lbof0+1; lb> sp->s_zshift; + boff = lb - (zone << sp->s_zshift); + if (boff > 0) { /* Zone already exixts */ + bsize = BLOCK_SIZE; + if ((error = minix_bmapfs(vp, lb, &pbn, NULL)) != 0) + return error; + } else { + bsize = sp->s_zsize; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) /* add the new zone to inode */ + return error; + } + if ((error = bread(devvp, pbn, bsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)bsize); + bwrite(bp); + } + /* Finally allocate lbof1, the required new block */ + + zone = lbof1 >> sp->s_zshift; + boff = lbof1 - (zone << sp->s_zshift); + if (boff > 0) { /* Zone already exists, just get the block */ + bsize = BLOCK_SIZE; + if ((error = minix_bmapfs(vp, lbof1, &pbn, NULL)) != 0) + return error; + } else { + bsize = sp->s_zsize; + if ((error = minix_zalloc(sp, &lbn, &pbn)) != 0) + return error; + if ((error = minix_addzone(ip, zone, lbn >> sp->s_zshift)) != 0) /* add the new zone to inode */ + return error; + } + if ((error = bread(devvp, pbn, bsize, NOCRED, &bp)) != 0) + return error; + bzero(bp->b_data, (size_t)bsize); + + *bpp = bp; + return 0; + +} +/* + * Returns the block number of the next free zone and sets + * the corresponding bit in the zone bitmap. + */ +int +minix_zalloc(struct minix_super_block *sp, u_daddr_t *lblkp, u_daddr_t *pblkp) +{ + int ic, error; + u_daddr_t zone, bblk; + daddr_t off; + struct buf *bp; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + u_daddr_t pbn = 0, pzn = 0; + u_int16_t *buf = sp->s_zbmap; + + *lblkp = 0; + *pblkp = 0; + + minix_get_lock(&sp->zmap_lock); + + if ((zone = minix_next_free_zone(sp)) == NO_ZONE) { + minix_free_lock(&sp->zmap_lock); + return ENOSPC; + } + + minix_write_zbit(sp, zone); + + ic = zone >> 4; /* Chunk that bit resides in */ + bblk = zone / BITS_PER_BLOCK; /* Block that bit is in */ + off = zone % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + bblk += 2 + sp->s_imap_blocks; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp, bblk, &bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_delete_zbit(sp, zone); + minix_free_lock(&sp->zmap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_delete_zbit(sp, zone); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->zmap_lock); + return error; + } + + minix_free_lock(&sp->zmap_lock); + + pzn = zone + sp->s_zoff; /* Physical zone number */ + pbn = pzn << sp->s_zshift; /* Physical block number */ + + *lblkp = pbn; + *pblkp = byte_to_blkn(blk_to_byte(pbn)); /* Suitable for bread */ + + return 0; +} +/* + * Deallocates a zone if the last block in it is released. + */ +int +minix_dzalloc(struct minix_super_block *sp, u_daddr_t zone) +{ + int ic, error; + u_daddr_t bblk; + daddr_t off; + struct buf *bp; + struct vnode *devvp = sp->s_devvp; + u_int16_t *buf = sp->s_zbmap; + union minix_block *mbp; + + minix_get_lock(&sp->zmap_lock); + + zone -= sp->s_zoff; /* Convert to bit offset */ + + if (minix_read_zbit(sp, zone)) + minix_delete_zbit(sp, zone); + else { + minix_free_lock(&sp->zmap_lock); + return 0; + } + + ic = zone >> 4; /* Chunk that bit resides in */ + bblk = zone / BITS_PER_BLOCK; /* Block that bit is in */ + off = zone % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + bblk += 2 + sp->s_imap_blocks; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp, bblk, &bp)) != 0) { + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_write_zbit(sp, zone); + minix_free_lock(&sp->zmap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_write_zbit(sp, zone); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->zmap_lock); + return error; + } + + minix_free_lock(&sp->zmap_lock); + + return 0; +} +/* + * Add a zone to the end of a file. "zone" is the logical zone + * offset in the file and pbn is the physical zone offset in the + * file system. It is the responsibility of the calling + * routine to guarantee that the next zone to add is at the + * logical end of the file. This routine returns EIO otherwise. + */ +int +minix_addzone(struct minix_inode *ip, u_daddr_t zone, u_daddr_t pbn) +{ + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + struct buf *bp; + u_daddr_t pind; + u_daddr_t id0, id1, id2, id3, off, blk; + int error, indirect = 0; + + pind = zone + 1; + + if (pind > TOT_DIRECT) + indirect++; + if (pind > TOT_SINDIRECT) + indirect++; + if (pind > TOT_DINDIRECT) + indirect++; + if (pind > TOT_TINDIRECT) + indirect++; + + switch (indirect) { + case 0: + if (dip->i_block[zone] != 0) + return EIO; + dip->i_block[zone] = pbn; + break; + case 3: + off = zone - TOT_DINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id3 = id2 >> INDIRECT_SHIFT; + id2 = id2 % V2_NR_INDIRECTS; + id1 = off % V2_NR_INDIRECTS; + if (dip->i_block[V2_NR_DBLOCKS+2] == 0) { + /* Generate a triple indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + id0 = blk >> sp->s_zshift; + dip->i_block[V2_NR_DBLOCKS+2] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS+2]; + + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + id0 = mbp->ind[id3]; + if (id0 == 0) { + /* Generate a double indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + mbp->ind[id3] = id0; + bwrite(bp); + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + bwrite(bp); + } else + bqrelse(bp); + goto rind2; + break; + case 2: + off = zone - TOT_SINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id1 = off % V2_NR_INDIRECTS; + if (dip->i_block[V2_NR_DBLOCKS+1] == 0) { + /* Generate double indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + id0 = blk >> sp->s_zshift; + dip->i_block[V2_NR_DBLOCKS+1] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + rind2: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + if (id0 == 0) { + /* Generate a single indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + mbp->ind[id2] = id0; + bwrite(bp); + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + bwrite(bp); + } else + bqrelse(bp); + goto rind1; + break; + case 1: + id1 = zone - TOT_DIRECT; + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + /* Generate a single indirect block */ + if ((error = minix_zalloc(sp, &blk, &pind)) != 0) + return error; + id0 = blk >> sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + bzero(bp->b_data, BLOCK_SIZE); + dip->i_block[V2_NR_DBLOCKS] = id0; + bwrite(bp); + } else + id0 = dip->i_block[V2_NR_DBLOCKS]; + rind1: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp, blk, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->ind[id1] = pbn; + bwrite(bp); + break; + default: + printf("minix_addzone: too large: zone = %d\n",(int)zone); + return ENOSPC; + } + + ip->i_flag |= IN_CHANGE | IN_UPDATE; + + return 0; +} +/* + * bmap returns the buffer block offset given the logical block offset. + * The offset returned is converted to buffer block units with DEV_BSHIFT. + */ +int +minix_bmapfs(struct vnode *vp, /* vnode of file */ + u_daddr_t lbk, /* logical block number */ + u_daddr_t *pbk, /* returned physical block number */ + int *runp) /* number of dev chunks to add */ +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + union minix_block *mbp; + struct buf *bp; + + int ndb = TOT_DIRECT; + int nsidb = TOT_SINDIRECT; + int ndidb = TOT_DINDIRECT; + int ntidb = TOT_TINDIRECT; + + int ndbpb; + u_daddr_t id, idp, id0=0, id1, id2, id3, blk; + daddr_t offset; + int error, indirect = 0; + + if (runp != NULL) { + ndbpb = BLOCK_SIZE >> DEV_BSHIFT; /* buffer blocks per minix block */ + if (ndbpb > 0) + *runp = ndbpb - 1; + else + *runp = 0; + } + + id = lbk >> sp->s_zshift; /* index by zones */ + offset = lbk - (id << sp->s_zshift); /* Block offset in zone */ + + idp = id + 1; + + if (idp > ndb) + indirect++; + if (idp > nsidb) + indirect++; + if (idp > ndidb) + indirect++; + if (idp > ntidb) + indirect++; + + *pbk = 0; + switch (indirect) { + case 0: /* Direct */ + if ((*pbk = (dip->i_block[id] << sp->s_zshift)) == 0) + return EFAULT; + *pbk += offset; + *pbk = ((*pbk)*BLOCK_SIZE) >> DEV_BSHIFT; + return 0; + case 3: /* Triple indirect */ + if ((blk = (dip->i_block[V2_NR_DBLOCKS+2] << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + brelse(bp); + return error; + } + mbp = MBLOCK(bp); + id -= ndidb; + id3 = (id >> INDIRECT_SHIFT) >> INDIRECT_SHIFT; + id2 = (id >> INDIRECT_SHIFT) % V2_NR_INDIRECTS; + id1 = id % V2_NR_INDIRECTS; + id0 = mbp->ind[id3]; + bqrelse(bp); + goto rind2; + case 2: /* Double indirect */ + id -= nsidb; + id2 = id >> INDIRECT_SHIFT; + id1 = id % V2_NR_INDIRECTS; + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + rind2: + if ((blk = (id0 << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + brelse(bp); + return error; + } + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + bqrelse(bp); + goto rind1; + case 1: /* Single indirect */ + id1 = id - ndb; + id0 = dip->i_block[V2_NR_DBLOCKS]; + rind1: + if ((blk = (id0 << sp->s_zshift)) == 0) + return EFAULT; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + if ((*pbk = (mbp->ind[id1] << sp->s_zshift)) == 0) { + brelse(bp); + return EFAULT; + } + bqrelse(bp); + *pbk += offset; + *pbk = ((*pbk)*BLOCK_SIZE) >> DEV_BSHIFT; + return 0; + default: + return ENOSPC; + } + + /* NOTREACHED */ +} +/* + * Returns a logical block in a buffer + */ +int +minix_getblk(struct vnode *devvp, block_t blk, struct buf **bpp) +{ + u_daddr_t offset; + int error; + + offset = (u_daddr_t)byte_to_blkn(blk_to_byte(blk)); + if ((error = bread(devvp, offset, BLOCK_SIZE, NOCRED, bpp)) != 0) + return error; + return 0; +} +/* + * Writes the buffer to disk + */ +int +minix_putblk(struct buf *bp) +{ + bp->b_flags &= ~B_ASYNC; + return bwrite(bp); +} +/* + * Releases the buffer block from any connection with the minixfs + */ +void +minix_freeblk(struct buf *bp) { + bp->b_flags |= B_FREEBUF; + brelse(bp); +} +/* + * Return buffer with the contents of block "offset" from the beginning of + * directory "ip". If "res" is non-zero, fill it in with a pointer to the + * remaining space in the directory. + */ +int +minix_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) +{ + struct buf *bp; + u_daddr_t lbn, pbn; + struct minix_inode *ip = VTOMI(vp); + struct vnode *devvp = ip->i_su->s_devvp; + int error; + + lbn = ((u_daddr_t)offset) / BLOCK_SIZE; + + if ((error = minix_bmapfs(vp, lbn, &pbn, (int*)NULL)) != 0) + return error; + + *bpp = NULL; + bp = NULL; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + if (res != NULL) + *res = (char *)bp->b_data + (int)(offset % BLOCK_SIZE); + *bpp = bp; + return 0; +} +/* + * The next few routines read or alter the in-core + * zone bitmaps. Any locking that is required is + * assumed to occur in the calling programs. + */ + +/* + * Return the number of free zones + */ +int +minix_free_zone_count(struct minix_super_block *sp) +{ + short nbits[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 }; + u_int16_t *bits = sp->s_zbmap; + int b1,b2,b3,b4,j,n; + int sum; + + sum = sp->s_zones - sp->s_firstdatazone + 1; + + n = ((sum-1)>>4) + 1; + for (j=0; j> 12) & 0xf; + b3 = (bits[j] >> 8) & 0xf; + b2 = (bits[j] >> 4) & 0xf; + b1 = bits[j] & 0xf; + sum -= (nbits[b1] + nbits[b2] + + nbits[b3] + nbits[b4]); + } + return(sum < 0 ? 0 : sum+1); /* Add one to counter bit zero in the bitmap */ +} +/* + * Returns the next free zone + */ +int +minix_next_free_zone(struct minix_super_block *sp) +{ + int i, n, s, nb; + u_int16_t *buf = sp->s_zbmap; + register int bit; + + nb = sp->s_zones - sp->s_firstdatazone + 1; + n = nb >> 4; + if ((nb % 16) > 0) + n += 1; + + /* Look for a hole in a chunk, then */ + /* search the chunk for the bit */ + + for (i=0; i> s) & 1)) { + bit = s + (i << 4); + return((bit < nb) ? bit : NO_ZONE); + } + return NO_ZONE; +} +/* + * Read a bit from the in-core data block bitmap + */ +int +minix_read_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + return ((int)((buf[w] >> s) & 0x1)); +} +/* + * Write a bit into the in-core data block bitmap + */ +void +minix_write_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] |= (1 << s); +} +/* + * Delete a bit in the in-core data block bitmap + */ +void +minix_delete_zbit(struct minix_super_block *sp, u_int32_t bit) +{ + u_int16_t *buf = sp->s_zbmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] &= ~(1 << s); +} +/* + * Figures out the number of data blocks in a file, + * including the indirect blocks, given the size + * of the file. + */ +int +minix_num_blocks(u_int16_t mode, u_int32_t size, short zshift) +{ + int nindirects, indirect = 0; + int nzones, nblocks = 1; + + switch (mode & I_TYPE) { + case I_LINK: + if (size < MINIX_MAXSYMLINKLEN) + return 0; /* No data blocks for a short symlink */ + return 1; /* One data block for a long symlink */ + case I_REGULAR: + break; + default: /* This includes Sock,B_Spec,C_Spec, and Fifo. */ + return 0; + } + if (size == 0) + return 0; + /* + * nblocks set initially to one above. Add the extra blocks below. + */ + nblocks += (size - 1) / BLOCK_SIZE; + nzones = nblocks >> zshift; + if (nblocks > (nzones << zshift)) + nzones += 1; + + /* Figure out whether we have indirect blocks */ + + if (nzones > TOT_DIRECT) + indirect++; /* Single indirect */ + + if (nzones > TOT_SINDIRECT) + indirect++; /* Double indirect */ + + if (nzones > TOT_DINDIRECT) + indirect++; /* Triple indirect */ + + switch (indirect) { + case 0: + return nblocks; + case 1: + return (nblocks + 1); /* One for the indirect */ + case 2: + nindirects = (nblocks - TOT_SINDIRECT - 1)/V2_NR_INDIRECTS; + return (nblocks + nindirects + 2); + case 3: + nindirects = (nblocks - TOT_DINDIRECT - 1) / V2_NR_INDIRECTS; + nindirects += nindirects / V2_NR_INDIRECTS; /* Number of extra doubles */ + return (nblocks + nindirects + V2_NR_INDIRECTS + 2); + default: + break; + } + return 0; /* NOTREACHED */ +} diff -ruN sys.orig/fs/minixfs/minix_ihash.c sys/fs/minixfs/minix_ihash.c --- sys.orig/fs/minixfs/minix_ihash.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_ihash.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,165 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This code was lifted from FreeBSD and modified for Minix. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static MALLOC_DEFINE(M_MNXIHASH, "MINIX ihash", "MINIX Inode hash tables"); +/* + * Structures associated with inode cacheing. + */ +static LIST_HEAD(mnxihashhead, minix_inode) *mnxihashtb; +static u_long minix_ihash; /* size of hash table - 1 */ +#define MNXINOHSH(device, inum) (&mnxihashtb[(minor(device) + (inum)) & minix_ihash]) +#ifndef NULL_SIMPLELOCKS +static struct simplelock minix_ihash_slock; +#endif + +/* + * Initialize inode hash table. + */ +void +minix_ihashinit(void) +{ + mnxihashtb = hashinit(desiredvnodes, M_MNXIHASH, &minix_ihash); + simple_lock_init(&minix_ihash_slock); +} +/* + * Free the inode hash table + */ +void +minix_ihashuninit(void) +{ + if (mnxihashtb) { + free(mnxihashtb, M_MNXIHASH); + mnxihashtb = NULL; + } +} +/* + * Use the device/inum pair to find the incore inode, and return a pointer + * to it. If it is in core, return it, even if it is locked. + */ +struct vnode * +minix_ihashlookup(dev_t dev, ino_t inum) +{ + struct minix_inode *ip; + + simple_lock(&minix_ihash_slock); + for (ip = MNXINOHSH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) + if (inum == ip->i_number && dev == ip->i_dev) + break; + simple_unlock(&minix_ihash_slock); + + if (ip) { + ip->i_vnode->v_type = minix_get_vtype(ip); + return (ip->i_vnode); + } + + return (NULLVP); +} + +/* + * Use the device/inum pair to find the incore inode, and return a pointer + * to it. If it is in core, but locked, wait for it. + */ +struct vnode * +minix_ihashget(dev_t dev, ino_t inum) +{ + struct proc *p = curproc; /* XXX */ + struct minix_inode *ip; + struct vnode *vp; + +loop: + simple_lock(&minix_ihash_slock); + for (ip = MNXINOHSH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) { + if (inum == ip->i_number && dev == ip->i_dev) { + vp = ip->i_vnode; + simple_lock(&vp->v_interlock); + simple_unlock(&minix_ihash_slock); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + goto loop; + vp->v_type = minix_get_vtype(ip); + return (vp); + } + } + simple_unlock(&minix_ihash_slock); + + return (NULLVP); +} + +/* + * Insert the inode into the hash table, and return it locked. + */ +void +minix_ihashins(struct minix_inode *ip) +{ + struct proc *p = curproc; /* XXX */ + struct mnxihashhead *ipp; + + if (1) + return; + + /* lock the inode, then put it on the appropriate hash list */ + lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + + simple_lock(&minix_ihash_slock); + ipp = MNXINOHSH(ip->i_dev, ip->i_number); + LIST_INSERT_HEAD(ipp, ip, i_hash); + ip->i_flag |= IN_HASHED; + simple_unlock(&minix_ihash_slock); +} + +/* + * Remove the inode from the hash table. + */ +void +minix_ihashrem(struct minix_inode *ip) +{ + if (1) + return; + + simple_lock(&minix_ihash_slock); + if (ip->i_flag & IN_HASHED) { + ip->i_flag &= ~IN_HASHED; + LIST_REMOVE(ip, i_hash); +#ifdef DIAGNOSTIC + ip->i_hash.le_next = NULL; + ip->i_hash.le_prev = NULL; +#endif + } + simple_unlock(&minix_ihash_slock); +} diff -ruN sys.orig/fs/minixfs/minix_inode.c sys/fs/minixfs/minix_inode.c --- sys.orig/fs/minixfs/minix_inode.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_inode.c Fri Feb 28 21:21:42 2003 @@ -0,0 +1,757 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_read_ibit(struct minix_super_block*,int); +void minix_write_ibit(struct minix_super_block*,int); +void minix_delete_ibit(struct minix_super_block*,int); +static int minix_truncatefs(struct minix_inode*,u_daddr_t,u_daddr_t); + +int +minix_makeinode(int mode, struct vnode *dvp, + struct vnode **vpp, struct componentname *cnp) +{ + struct minix_inode *dip, *ip; + struct vnode *tvp; + struct minix_direct newdir; + int error; + + dip = VTOMI(dvp); + *vpp = NULL; + + if ((mode & IFMT) == 0) + mode |= IFREG; + + if ((error = minix_valloc(dvp, mode, cnp->cn_cred, &tvp)) != 0) + return error; + + ip = VTOMI(tvp); + ip->i_dino.i_gid = dip->i_dino.i_gid; + + /* + * If we are not the owner of the directory, + * and we are hacking owners here, (only do this where told to) + * and we are not giving it TO root, (would subvert quotas) + * then go ahead and give it to the other user. + * Note that this drops off the execute bits for security. + */ + if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && + (dip->i_dino.i_mode & ISUID) && + (dip->i_dino.i_uid != cnp->cn_cred->cr_uid) && dip->i_dino.i_uid) { + ip->i_dino.i_uid = dip->i_dino.i_uid; + mode &= ~07111; + } else + ip->i_dino.i_uid = cnp->cn_cred->cr_uid; + + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + ip->i_mode = mode; + ip->i_dino.i_mode = mode; + tvp->v_type = minix_get_vtype(ip); /* Rest init'd in getnewvnode(). */ + ip->i_nlink = 1; + + if ((ip->i_mode & ISGID) && !groupmember(ip->i_dino.i_gid, cnp->cn_cred) && + suser_xxx(cnp->cn_cred, 0, 0)) + ip->i_mode &= ~ISGID; + /* + * Make sure inode goes to disk before directory entry. + */ + if ((error = minix_update(tvp)) != 0) + goto bad; + + minix_makedirentry(ip, cnp, &newdir); + + if ((error = minix_direnter(dvp, tvp, &newdir, cnp)) != 0) + goto bad; + + *vpp = tvp; + + return 0; +bad: + /* + * Write error occurred trying to update the inode + * or the directory so must deallocate the inode. + */ + ip->i_nlink = 0; + ip->i_flag |= IN_CHANGE; + vput(tvp); + return error; +} +/* + * Truncate the inode to at most length size, freeing the + * disk blocks. + */ +int +minix_truncate(struct vnode *vp, + off_t length, + int flags, + struct ucred *cred, + struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + u_daddr_t lbn0, lbn1, len32; + int error; + + if (length > ~(1 << 31)) /* 32-bit offsets only! */ + return EFBIG; + + len32 = (u_daddr_t)length; + + /* Data in a short symlink is stored in the inode */ + + if (vp->v_type == VLNK && + dip->i_size < vp->v_mount->mnt_maxsymlinklen) { + bzero((char*)ip->i_shortlink, MINIX_MAXSYMLINKLEN); + dip->i_size = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(vp); + } + if (dip->i_size <= len32) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(vp); + } + + /* lbn1 is the last zone in the file */ + + lbn1 = (dip->i_size - 1)/sp->s_zsize; + + /* lbn0 is the first zone to eliminate */ + + if (len32 > 0) + lbn0 = (len32 - 1)/sp->s_zsize + 1; + else + lbn0 = 0; /* Eliminate all zones */ + + if (lbn0 > lbn1) /* Silly but check anyway */ + return EIO; + + /* truncatefs will eliminate all zones from lbn0 to EOF */ + + if ((error = minix_truncatefs(ip, lbn0, len32)) != 0) + return error; + + dip->i_size = len32; /* The new length of the file */ + ip->i_blocks = minix_num_blocks(ip->i_mode, len32, sp->s_zshift); + + ip->i_flag |= IN_CHANGE | IN_UPDATE; + + return minix_update(vp); +} +/* + * Frees all zones from the logical offset lbn to the end of the file. + */ +static int +minix_truncatefs(struct minix_inode *ip, u_daddr_t lbn, u_daddr_t length) +{ + struct buf *bp; + union minix_block *mbp; + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lb0, lb, off = 0; + u_daddr_t blk, id0, id1, id2, id3, zone; + int error, indirect; + int delete1, delete2, delete3; + + if (dip->i_size == 0) + return 0; + + lb = lb0 = (dip->i_size - 1)/sp->s_zsize; + + if (lb < lbn) + return EIO; + + do { + delete1 = 0; + delete2 = 0; + delete3 = 0; + indirect = 0; + if (lb >= TOT_DIRECT) + indirect++; + if (lb >= TOT_SINDIRECT) + indirect++; + if (lb >= TOT_DINDIRECT) + indirect++; + if (lb >= TOT_TINDIRECT) + indirect++; + + switch (indirect) { + case 0: + if ((error = minix_dzalloc(sp, dip->i_block[lb])) != 0) + return error; + dip->i_block[lb] = 0; + break; + case 3: + off = lb - TOT_DINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id3 = id2 >> INDIRECT_SHIFT; + id2 = id2 % V2_NR_INDIRECTS; + id1 = off % V2_NR_INDIRECTS; + if (id1 == 0) { + delete1 = 1; + if (id2 == 0) { + delete2 = 1; + if (id3 == 0) + delete3 = 1; + } + } + blk = dip->i_block[V2_NR_DBLOCKS+2] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return 0; + mbp = MBLOCK(bp); + id0 = mbp->ind[id3]; + if (delete3) { + zone = dip->i_block[V2_NR_DBLOCKS+2]; + dip->i_block[V2_NR_DBLOCKS+2] = 0; + if ((error = minix_dzalloc(sp, zone)) != 0) + return error; + brelse(bp); + } else { + if (delete2) { + mbp->ind[id3] = 0; + bwrite(bp); + } else + bqrelse(bp); + } + goto rind2; + case 2: + off = lb - TOT_SINDIRECT; + id2 = off >> INDIRECT_SHIFT; + id1 = off % V2_NR_INDIRECTS; + if (id1 == 0) { + delete1 = 1; + if (id2 == 0) + delete2 = 1; + } + id0 = dip->i_block[V2_NR_DBLOCKS+1]; + if (delete2) + dip->i_block[V2_NR_DBLOCKS+1] = 0; + rind2: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + if (delete2) { + if ((error = minix_dzalloc(sp,id0)) != 0) + return error; + } + mbp = MBLOCK(bp); + id0 = mbp->ind[id2]; + if (delete2) + brelse(bp); + else { + if (delete1) { + mbp->ind[id2] = 0; + bwrite(bp); + } else + bqrelse(bp); + } + goto rind1; + case 1: + id1 = lb - TOT_DIRECT; + if (id1 == 0) + delete1 = 1; + id0 = dip->i_block[V2_NR_DBLOCKS]; + if (delete1) + dip->i_block[V2_NR_DBLOCKS] = 0; + rind1: + blk = id0 << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + if ((error = minix_dzalloc(sp, mbp->ind[id1])) != 0) + return error; + if (delete1) { + if ((error = minix_dzalloc(sp, id0)) != 0) + return error; + brelse(bp); + } else { + mbp->ind[id1] = 0; + bwrite(bp); + } + break; + default: + return EIO; + } + + } while (lbn < lb--); + + return 0; +} +/* + * Update the access, modified, and inode change times as specified by the + * IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode + * to disk if the IN_MODIFIED flag is set (it may be set initially, or by + * the timestamp update). + */ +int +minix_update(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + + minix_itimes(vp); + + if ((ip->i_flag & IN_MODIFIED) == 0) + return 0; + + ip->i_flag &= ~(IN_MODIFIED); + + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return 0; + + return minix_iput(ip); +} + +void +minix_itimes(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + struct timespec ts; + + if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0) + return; + + if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { + vfs_timestamp(&ts); + if (ip->i_flag & IN_ACCESS) { + ip->i_dino.i_atime = ts.tv_sec; + } + if (ip->i_flag & IN_UPDATE) { + ip->i_dino.i_mtime = ts.tv_sec; + } + if (ip->i_flag & IN_CHANGE) { + ip->i_dino.i_ctime = ts.tv_sec; + } + ip->i_flag |= IN_MODIFIED; + } + ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); +} +/* + * The following access routine was lifted from the UFS code. + */ +int +minix_dinode_access(struct minix_dinode *dip, int mode, + struct ucred *cred, struct minix_super_block *sp) +{ + int i,mask; + gid_t *gp; + + /* + * Disallow write attempts on read-only file systems; + * unless the file is a socket, fifo, or a block or + * character device resident on the file system. + */ + + if (mode & VWRITE) { + switch ((dip->i_mode) & I_TYPE) { + case I_DIRECTORY: + case I_LINK: + case I_REGULAR: + if (sp->s_rdonly != 0) + return EROFS; + break; + } + } + + /* No immutable bit in minix */ + + /* user id 0 always gets access. */ + + if (cred->cr_uid == 0) + return 0; + + mask = 0; + + /* check the owner. */ + + if (cred->cr_uid == dip->i_uid) { + if (mode & VEXEC) + mask |= S_IXUSR; + if (mode & VREAD) + mask |= S_IRUSR; + if (mode & VWRITE) + mask |= S_IWUSR; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); + } + + /* check the groups. */ + + for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) + if (dip->i_gid == *gp) { + if (mode & VEXEC) + mask |= S_IXGRP; + if (mode & VREAD) + mask |= S_IRGRP; + if (mode & VWRITE) + mask |= S_IWGRP; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); + } + + /* check everyone else. */ + + if (mode & VEXEC) + mask |= S_IXOTH; + if (mode & VREAD) + mask |= S_IROTH; + if (mode & VWRITE) + mask |= S_IWOTH; + return ((dip->i_mode & mask) == mask ? 0 : EACCES); +} + +/* Clean up the inode associated with the vnode before freeing it */ + +/* + * Free an inode; put it back into the block that it belongs + * and then free the block. Update the superblock if necessary. + */ + +int +minix_vfree(struct vnode *vp, ino_t ino, int mode) +{ + struct minix_inode *ip = VTOMI(vp); + + return minix_dialloc(ip->i_su, ino); +} +/* + * Get a minix inode with no vnode attached. Routine + * assumes that space for the inode, pointed to by ip, + * is supplied by the caller. Also notice that there + * is no vnode involved here, so the elements i_vnode + * and i_mmp are set to NULL and i_parent = 0; + */ +int +minix_iget(struct vnode *devvp, struct minix_super_block *sp, + mino_t ino, struct minix_inode *ip) +{ + struct buf *bp; + block_t blk; + union minix_block *mbp; + int error; + u_daddr_t off; + + bzero((caddr_t)ip, sizeof(struct minix_inode)); + blk = (block_t)ino_to_byte(sp,ino)/BLOCK_SIZE; + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + + mbp = MBLOCK(bp); + off = (ino-1) % V2_INODES_PER_BLOCK; + ip->i_dino = mbp->dinode[off]; + + bqrelse(bp); + + ip->i_number = ino; + ip->i_parent = 0; + ip->i_su = sp; + ip->i_vnode = NULL; + ip->i_mode = ip->i_dino.i_mode; + ip->i_mmp = NULL; + ip->i_dev = devvp->v_rdev; + ip->i_flag = 0; + + return 0; +} +/* + * Write an inode; assumes that the caller will + * release the space pointed to by ip when finished. + */ +int +minix_iput(struct minix_inode *ip) +{ + struct vnode *devvp; + struct buf *bp; + union minix_block *mbp; + mino_t ino; + block_t blk; + u_daddr_t off; + int error; + + devvp = ip->i_su->s_devvp; + ino = ip->i_number; + blk = (block_t)ino_to_byte(ip->i_su,ino)/BLOCK_SIZE; + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + return error; + } + + mbp = MBLOCK(bp); + off = (ino-1) % V2_INODES_PER_BLOCK; + mbp->dinode[off] = ip->i_dino; + + return minix_putblk(bp); +} +/* + * Returns the next free inode number, sets the bitmap + * to active, writes the bitmap to disk, and cleans + * the on disk dinode. + */ +int +minix_ialloc(struct minix_super_block *sp, int *inop) +{ + int ino, ic, blk, off, error; + u_int16_t *buf = sp->s_ibmap; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + struct minix_inode in; + union minix_block *mbp; + + *inop = 0; + + minix_get_lock(&sp->imap_lock); + + if ((ino = minix_next_free_inode(sp)) == NO_INODE) { + minix_free_lock(&sp->imap_lock); + printf("minix_next_free_inode: returned zero inode\n"); + return ENOSPC; + } + + minix_write_ibit(sp, ino); + + ic = ino >> 4; /* Chunk that bit resides in */ + blk = ino / BITS_PER_BLOCK; /* Block that bit is in */ + off = ino % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + blk += 2; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_delete_ibit(sp, ino); + minix_free_lock(&sp->imap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_delete_ibit(sp,ino); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->imap_lock); + return error; + } + + if ((error = minix_iget(devvp,sp,ino,&in)) != 0) { + minix_free_lock(&sp->imap_lock); + minix_dialloc(sp, ino); + return error; + } + + minix_wipe_dinode(&(in.i_dino)); + + if ((error = minix_iput(&in)) != 0) { + minix_free_lock(&sp->imap_lock); + minix_dialloc(sp,ino); + return error; + } + + minix_free_lock(&sp->imap_lock); + + *inop = ino; + + return 0; +} +int +minix_dialloc(struct minix_super_block *sp, int ino) +{ + int blk, ic, off, error; + u_int16_t *buf = sp->s_ibmap; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + union minix_block *mbp; + + minix_get_lock(&sp->imap_lock); + + if (minix_read_ibit(sp, ino)) + minix_delete_ibit(sp, ino); + else { + minix_free_lock(&sp->imap_lock); + return 0; + } + + ic = ino >> 4; /* Chunk that bit resides in */ + blk = ino / BITS_PER_BLOCK; /* Block that bit is in */ + off = ino % BITS_PER_BLOCK; /* Bit offset in block */ + off >>= 4; /* Chunk offset in block */ + blk += 2; /* Adjust for offset in file */ + + bp = NULL; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) { + if (bp != NULL) + brelse(bp); + minix_write_ibit(sp, ino); + minix_free_lock(&sp->imap_lock); + return error; + } + + mbp = MBLOCK(bp); + mbp->bitchunk[off] = buf[ic]; + + if ((error = minix_putblk(bp)) != 0) { + minix_write_ibit(sp,ino); + if (bp != NULL) { + bp->b_flags |= B_INVAL; + brelse(bp); + } + minix_free_lock(&sp->imap_lock); + return error; + } + + minix_free_lock(&sp->imap_lock); + + return 0; +} +/* + * The next few routines manipulate/read the inode bitmaps. + * Any locking that is needed is assumed to occur in the + * calling programs. + */ +/* + * Counts the number of free inodes + */ +int +minix_free_inode_count(struct minix_super_block *sp) +{ + short nbits[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 }; + u_int16_t *bits = sp->s_ibmap; + int b1,b2,b3,b4,j,n; + int sum; + + sum = sp->s_ninodes; + + n = ((sp->s_ninodes-1)>>4); + for (j=0; j> 12) & 0xf; + b3 = (bits[j] >> 8) & 0xf; + b2 = (bits[j] >> 4) & 0xf; + b1 = bits[j] & 0xf; + sum -= (nbits[b1] + nbits[b2] + + nbits[b3] + nbits[b4]); + } + return(sum < 0 ? 0 : sum+1); /* Add one to counter bit zero in the bitmap */ +} +/* + * Return the next free inode from the inode bitmap (very simple) + */ +int +minix_next_free_inode(struct minix_super_block *sp) +{ + int i, n, s; + u_int16_t *buf = sp->s_ibmap; + register int bit; + + n = sp->s_ninodes >> 4; + if ((sp->s_ninodes % 16) > 0) + n += 1; + + /* Look for a hole in a chunk, then */ + /* search the chunk for the bit */ + + for (i=0; i> s) & 1)) { + bit = s + (i << 4); + return((bit < sp->s_ninodes) ? bit : NO_INODE); + } + return NO_INODE; +} +/* + * Read a bit from the in-core inode bitmap + * note log2(16) = 4 + */ +int +minix_read_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + return ((int)((buf[w] >> s) & 0x1)); +} +/* + * Write a bit into the in-core inode bitmap + */ +void +minix_write_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] |= (1 << s); +} +/* + * Delete a bit in the in-core inode bitmap + */ +void +minix_delete_ibit(struct minix_super_block *sp, int bit) +{ + u_int16_t *buf = sp->s_ibmap; + int w, s; + + w = bit >> 4; + s = bit % 16; + + buf[w] &= ~(1 << s); +} + +void +minix_wipe_dinode(struct minix_dinode *dip) +{ + bzero((char*)dip, sizeof(struct minix_dinode)); +} diff -ruN sys.orig/fs/minixfs/minix_locks.c sys/fs/minixfs/minix_locks.c --- sys.orig/fs/minixfs/minix_locks.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_locks.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +u_int32_t _minix_alock(u_int32_t*); + +void +minix_get_lock(u_int32_t *lock) +{ + while(_minix_alock(lock)) + tsleep(lock, PINOD, "Mnxlck", 0); +} + +void +minix_free_lock(u_int32_t *lock) +{ + *lock = 0l; + wakeup(lock); +} diff -ruN sys.orig/fs/minixfs/minix_lookup.c sys/fs/minixfs/minix_lookup.c --- sys.orig/fs/minixfs/minix_lookup.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_lookup.c Fri Feb 28 21:28:31 2003 @@ -0,0 +1,1273 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Much of the code below follows FreeBSD's ufs implementation */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +struct minix_namei_args { + struct vnode *a_devvp; + struct minix_super_block *a_sp; + struct ucred *a_cred; + struct proc *a_pp; +}; + +int minix_lookup(struct vop_cachedlookup_args*); + +static int minix_namei(struct minix_namei_args*,char*,ino_t*,ino_t*,int*); +static int minix_newdirent(struct vnode*); +static int minix_dirsize(struct vnode*, u_long*); +static int minix_dircount(struct vnode*, u_long*); +static int minix_dirmove(struct vnode*, struct minix_direct*, u_long); +static int minix_dirclean(struct vnode*); +static int minix_dircleanup(struct vnode*); +static char *minix_strtok(char*, char*); +static char *minix_strtok_r(char*, char*, char**); + +ino_t root_inode, current_inode; /* For communication with minix_namei(). */ + +int +minix_lookup(struct vop_cachedlookup_args *ap) + /* + struct vop_cachedlookup_args + { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + } *ap; + */ +{ + struct vnode *dvp = ap->a_dvp; + struct vnode **vpp = ap->a_vpp; + struct componentname *cnp = ap->a_cnp; + struct vnode *vp = NULL; + int error, isdot, entry; + u_long flags, islastcn, lockparent, nameiop, wantparent; + struct proc *pp; + struct mount *mp; + struct ucred *cred; + struct minix_inode *dip; /* minix inode for directory being searched */ + struct minix_inode *ip; /* target inode */ + struct minixmount *mmp; /* minix mount information */ + struct minix_super_block *msp; + struct minix_namei_args nia; + ino_t mdino; /* minix initial directory inode number */ + ino_t mino, pino; /* minix target inode number and parent */ + char path[PATH_MAX+1]; + + nameiop = cnp->cn_nameiop; + flags = cnp->cn_flags; + lockparent = flags & LOCKPARENT; + islastcn = flags & ISLASTCN; + wantparent = flags & (LOCKPARENT|WANTPARENT); + + pp = cnp->cn_proc; + cred = pp->p_cred->pc_ucred; + dip = VTOMI(dvp); + mmp = dip->i_mmp; + mp = mmp->mnx_mp; + msp = mmp->mnx_su; + + root_inode = (ino_t)msp->s_root->i_number; + current_inode = (ino_t)dip->i_number; + + mdino = current_inode; + + isdot = ((cnp->cn_namelen) == 1 && (cnp->cn_nameptr[0] == '.')); + + if (mdino == 0) + return ERANGE; + /* + * Check accessibility of directory. + */ + if (dvp->v_type != VDIR) + return ENOTDIR; + + if ((error = VOP_ACCESS(dvp, VEXEC, cred, pp)) != 0) + return error; + + if (islastcn && (dvp->v_mount->mnt_flag & MNT_RDONLY) && + (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == CREATE || + cnp->cn_nameiop == RENAME)) + return EROFS; + + /* + * Search dvp for the component cnp->cn_nameptr. + */ + nia.a_devvp = mmp->mnx_devvp; + nia.a_sp = mmp->mnx_su; + nia.a_cred = cred; + nia.a_pp = pp; + + /* We assume that the pathlength has been checked earlier */ + + bzero(path, PATH_MAX+1); + bcopy(cnp->cn_nameptr, path, cnp->cn_namelen); + + error = minix_namei(&nia, path, &mino, &pino, &entry); + + if (error != 0) { + + if (error != ENOENT) + return error; + + if ((nameiop == CREATE || nameiop == RENAME) + && islastcn && wantparent + && dip->i_dino.i_nlinks != 0) { + /* + * Check for write access on directory. + */ + if((error = VOP_ACCESS(dvp, VWRITE, cred, pp)) != 0) + return error; + /* + * Possibly record the position of a slot in the directory + * large enough for the new component name. This can be + * recorded in the vnode private data for dvp. + * Set the SAVENAME flag to hold onto the pathname for use + * later in VOP_CREATE or VOP_RENAME. + */ + + dip->i_entry = entry; + + cnp->cn_flags |= SAVENAME; + if (!lockparent) + /* + * Note that the extra data recorded above is only + * useful if lockparent is specified. + */ + VOP_UNLOCK(dvp, 0, pp); + + return EJUSTRETURN; + } + + /* + * Consider inserting name into cache. + */ + if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + cache_enter(dvp, NULL, cnp); + + return ENOENT; + } else { + /* + * If deleting, and at end of pathname, return parameters + * which can be used to remove file. If the wantparent flag + * isn't set, we return only the directory, otherwise we go on + * and lock the inode, being careful with ".". + */ + if (nameiop == DELETE && islastcn) { + /* + * Check for write access on directory. + */ + if ((error = VOP_ACCESS(dvp, VWRITE, cred, pp)) != 0) + return error; + + dip->i_entry = entry; + + if (mino == dip->i_number || isdot) { + VREF(dvp); + *vpp = dvp; + return 0; + } + + if ((error = VFS_VGET(dvp->v_mount, mino, &vp)) != 0) + return error; + + ip = VTOMI(vp); + ip->i_parent = pino; /* Record the parent inode */ + +/* Minix does not support the concept of a sticky bit (:<)! + + if (directory is sticky + && cred->cr_uid != 0 + && cred->cr_uid != owner of dvp + && owner of vp != cred->cr_uid) { + vput(vp); + return EPERM; + } +*/ + *vpp = vp; + if (!lockparent) + VOP_UNLOCK(dvp, 0, pp); + + return 0; + } + /* + * If rewriting (RENAME), return the inode and the + * information required to rewrite the present directory + * Must get inode of directory entry to verify it's a + * regular file, or empty directory. + */ + if (nameiop == RENAME && wantparent && islastcn) { + error = VOP_ACCESS(dvp, VWRITE, cred, pp); + if (error) + return (error); + + dip->i_entry = entry; + + /* + * Check for "." + */ + if (mino == dip->i_number || isdot) + return EISDIR; + + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) + return error; + *vpp = vp; + /* + * Save the name for use in VOP_RENAME later. + */ + cnp->cn_flags |= SAVENAME; + if (!lockparent) + VOP_UNLOCK(dvp, 0, pp); + + return 0; + } + + /* + * Step through the translation in the name. We do not `vput' the + * directory because we may need it again if a symbolic link + * is relative to the current directory. Instead we save it + * unlocked as "pdp". We must get the target inode before unlocking + * the directory to insure that the inode will not be removed + * before we get it. We prevent deadlock by always fetching + * inodes from the root, moving down the directory tree. Thus + * when following backward pointers ".." we must unlock the + * parent directory before getting the requested directory. + * There is a potential race condition here if both the current + * and parent directories are removed before the VFS_VGET for the + * inode associated with ".." returns. We hope that this occurs + * infrequently since we cannot avoid this race condition without + * implementing a sophisticated deadlock detection algorithm. + * Note also that this simple deadlock detection scheme will not + * work if the file system has any hard links other than ".." + * that point backwards in the directory structure. + */ + if (flags & ISDOTDOT) { + VOP_UNLOCK(dvp, 0, pp); /* race to get the inode */ + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) { + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, pp); + return (error); + } + if (lockparent && islastcn) { + error = vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, pp); + if (error) { + vput(vp); + return error; + } + } + *vpp = vp; + } else if (mino == dip->i_number || isdot) { + VREF(dvp); /* we want ourself, ie "." */ + *vpp = dvp; + } else { + error = VFS_VGET(dvp->v_mount, mino, &vp); + if (error) + return (error); + if (!lockparent || !islastcn) + VOP_UNLOCK(dvp, 0, pp); + *vpp = vp; + } + + /* + * Insert name into cache if appropriate. + */ + if (cnp->cn_flags & MAKEENTRY) + cache_enter(dvp, *vpp, cnp); + return (0); + } +} + +/*********************************************************************** + * * + * namei() parses the directory path and returns the inode number * + * of the last token in the path. If there is no path then the * + * current inode number is returned. If the path leads to no inode * + * then zero is returned and ENOENT is returned as an error. * + * by Ed Alley 021006 * + * * + ***********************************************************************/ + +static int +minix_namei(struct minix_namei_args *ap, char *path, ino_t *ino, ino_t *pino, int *entp) +{ + struct vnode *devvp = ap->a_devvp; + struct minix_super_block *sp = ap->a_sp; + struct ucred *cred = ap->a_cred; + struct buf *bp; + struct minix_inode *ip, in; + struct minix_dinode *dip; + int i, ib, id, j, error, len, entry = 0; + char ppath[256], *pname; + struct minix_direct dir[NR_DIR_ENTRIES]; + unsigned long ind1[V2_INDIRECTS], blk; + ino_t inum, inuml; + + *ino = 0; + *pino = 0; + *entp = -1; + + if ((len = strlen(path)) > 255) + return ENAMETOOLONG; + + if (path == NULL) { + *ino = current_inode; + return ENOENT; + } + + bzero(ppath, 256); + + if (path[0] == '/') + inum = root_inode; + else + inum = current_inode; + + strncpy(ppath, path, len+1); + + if (ppath[0] == '\0') { + *ino = inum; + return 0; + } + + /* Get the current directory */ + + if ((error = minix_iget(devvp,sp,(mino_t)inum,&in)) != 0) + return error; + + ip = ∈ + dip = &(in.i_dino); /* the dinode of current directory */ + + pname = NULL; + pname = minix_strtok(ppath, "/"); + inuml = inum; + + ip->i_noent = -1; + ip->i_entry = -1; + + while(pname != NULL) { + + ip->i_noent = -1; + ip->i_entry = -1; + + if (!(ip->i_mode & IFDIR)) + return ENOTDIR; + + if (minix_dinode_access(dip,VEXEC,cred,sp) != 0) + return EACCES; + + /* Search directory */ + + entry = 0; + for (i=0; ii_block[i] == 0) { + if (ip->i_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + ib = 1 << sp->s_zshift; + blk = dip->i_block[i] << sp->s_zshift; + while(ib--) { + if((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (j=0; ji_noent < 0) + ip->i_noent = entry; + entry++; + continue; + } + if (!strncmp(pname, dir[j].d_name,MINIX_NAME_MAX)) { + ip->i_entry = entry; + goto gotj; + } + entry++; + } + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + if (ip->i_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent < 0) + ip->i_noent = entry; + return ENOENT; + } + ib = 1 << sp->s_zshift; + blk = ind1[id] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (j=0; ji_noent < 0) + ip->i_noent = entry; + entry++; + continue; + } + if (!strncmp(pname, dir[j].d_name,MINIX_NAME_MAX)) { + ip->i_entry = entry; + goto gotj; + } + entry++; + } + } + } + + /* + * Dropped through: + * Could not find an entry: return "no entry". + */ + + if (ip->i_noent < 0) + ip->i_noent = entry; + + *ino = 0; + *pino = inuml; + *entp = -1; + + return ENOENT; + + gotj: + /* + * Found an entry; get the inode and look for another token. + */ + inuml = inum; + if (!strcmp(dir[j].d_name,"..") && inum == root_inode) + inum = root_inode; + else + inum = dir[j].d_ino; + + if ((error = minix_iget(devvp,sp,(mino_t)inum,ip)) != 0) + return error; + + pname = minix_strtok((char*)NULL, "/"); + } + + /* + * Return the inode for the entry found, and related information. + */ + + *ino = inum; + *pino = inuml; + *entp = entry; + + return 0; +} +/* + * Construct a new directory entry after a call to namei, using the + * parameters that it left in the componentname argument cnp. The + * argument ip is the inode to which the new directory entry will refer. + */ +void +minix_makedirentry(ip, cnp, newdirp) + struct minix_inode *ip; + struct componentname *cnp; + struct minix_direct *newdirp; +{ + int namelen; + bzero(newdirp->d_name, MINIX_NAME_MAX); + + newdirp->d_ino = (short)ip->i_number; + + namelen = strlen(cnp->cn_nameptr); + if (namelen > MINIX_NAME_MAX) + namelen = MINIX_NAME_MAX; + bcopy(cnp->cn_nameptr, newdirp->d_name, namelen); +} +/* + * Write a directory entry after a call to namei, using the parameters + * that it left in nameidata. The argument dirp is the new directory + * entry contents. Dvp is a pointer to the directory to be written, + * which was left locked by namei. Remaining parameter: dp->i_noent + * was left by namei and indicates the entry into the directory list + * where a new entry may be placed. + */ +int +minix_direnter(dvp, tvp, dirp, cnp) + struct vnode *dvp; + struct vnode *tvp; + struct minix_direct *dirp; + struct componentname *cnp; +{ + struct ucred *cr; + struct proc *p; + int newentrysize, newent; + u_int32_t bln, off, newsize; + off_t offset; + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_direct *ep; + struct iovec aiov; + struct uio auio; + struct buf *bp; + char *dirbuf; + int error; + + p = curproc; + cr = p->p_ucred; + + newentrysize = DIR_ENTRY_SIZE; + + if ((error = minix_newdirent(dvp)) != 0) + return error; + if (ip->i_noent < 0 && ip->i_entry < 0) + return ENOSPC; + + if (ip->i_noent < 0 && ip->i_entry >= 0) { /* No Entries Available */ + if (!(ip->i_entry < MAX_DIR_ENTRIES)) + return ENOSPC; + bln = ip->i_entry / NR_DIR_ENTRIES; + auio.uio_offset = bln*BLOCK_SIZE; + auio.uio_resid = newentrysize; + aiov.iov_len = newentrysize; + aiov.iov_base = (caddr_t)dirp; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_rw = UIO_WRITE; + auio.uio_segflg = UIO_SYSSPACE; + auio.uio_procp = (struct proc*)0; + error = VOP_WRITE(dvp, &auio, IO_SYNC, cnp->cn_cred); + ip->i_flag |= IN_CHANGE; + return error; + } + + if (ip->i_noent >= 0) + newent = ip->i_noent; + else + newent = ip->i_entry; + + bln = newent / NR_DIR_ENTRIES; + off = newent % NR_DIR_ENTRIES; + offset = (off_t)(bln*BLOCK_SIZE + off*newentrysize); + + if ((error = minix_blkatoff(dvp, offset, &dirbuf, &bp)) != 0) + return error; + ep = (struct minix_direct*)dirbuf; + *ep = *dirp; + bwrite(bp); + + newsize = (u_int32_t)offset + newentrysize; + if (newsize > dip->i_size) + dip->i_size = newsize; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return minix_update(dvp); +} +static int +minix_dircleanup(struct vnode *dvp) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + u_daddr_t bln; + u_long newsize; + int error; + + if ((error = minix_dirsize(dvp, &newsize)) != 0) + return error; + + bln = minix_num_blocks(ip->i_mode, (u_int32_t)newsize, sp->s_zshift); + + if (ip->i_blocks > bln) + if ((error = minix_truncate(dvp, (off_t)newsize, IO_SYNC, NOCRED, NULL)) != 0) + return error; + + if (bln > ip->i_blocks) + vnode_pager_setsize(dvp, (vm_ooffset_t)(bln*BLOCK_SIZE)); + + ip->i_blocks = bln; + dip->i_size = newsize; + + return 0; +} +/* + * Removes an entry from a directory. + * NOTE: Will not remove . or .. but returns ENOENT + * in that case. + */ +int +minix_dirremove(struct vnode *dvp) +{ + struct buf *bp; + struct minix_inode *dip = VTOMI(dvp); + struct minix_dinode *dinp = &(dip->i_dino); + union minix_block *mbp; + struct minix_direct *dirp; + struct minix_super_block *sp = dip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t ind, bln, off, dsiz; + u_daddr_t blks, blkc, zone, boff; + u_long count, size; + int entry, error; + + /* + * Entries 0 and 1 are '.' and '..' respectively. + */ + + if ((entry = dip->i_entry) < 2) + return ENOENT; + + bln = entry / NR_DIR_ENTRIES; + off = entry % NR_DIR_ENTRIES; + zone = bln >> sp->s_zshift; + boff = bln - (zone << sp->s_zshift); + + if (zone < V2_NR_DBLOCKS) { + zone = dinp->i_block[zone]; + bln = (zone << sp->s_zshift) + boff; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = 0; + bwrite(bp); + } else { + zone -= V2_NR_DBLOCKS; + bln = dinp->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + ind = mbp->ind[zone]; + bqrelse(bp); + bln = (ind << sp->s_zshift) + boff; + if ((error = minix_getblk(devvp,bln,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = 0; + bwrite(bp); + } + + if ((error = minix_dirsize(dvp, &size)) != 0) + return error; + if ((error = minix_dircount(dvp, &count)) != 0) + return error; + + blks = size / BLOCK_SIZE; + blkc = count / NR_DIR_ENTRIES; + + if (blkc < blks && count > 2) { + dsiz = BLOCK_SIZE*(blkc+1); + dirp = (struct minix_direct*)malloc(dsiz, M_MINIXNOD, M_WAITOK); + bzero((char*)dirp, dsiz); + if ((error = minix_dirmove(dvp, dirp, count)) != 0) + return error; + if ((error = minix_dirclean(dvp)) != 0) + return error; + for (ind=2; indi_noent. + * Routine returns empty entry number in ip->i_noent + * and zero as the error number. If no entry, because + * the available space is full, then the routine returns + * the next entry number and 0 as an error. + * Finally ENOSPC is returned if we are out of free entries. + * + * Need to improve this by getting an idea of the + * size of the search, so we don't have to search through + * the entire space as we do here. + */ +static int +minix_newdirent(struct vnode *vp) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + struct minix_direct dir[NR_DIR_ENTRIES]; + unsigned long ind1[V2_INDIRECTS]; + u_int32_t blk; + int ib, id, iz, error, entry = 0; + + for (iz=0; izi_block[iz] == 0) { + ip->i_noent = -1; + ip->i_entry = entry; + return 0; + } + blk = dip->i_block[iz] << sp->s_zshift; + ib = 1 << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent = entry; + ip->i_entry = -1; + return 0; + } + entry++; + } + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) { + ip->i_noent = -1; + ip->i_entry = entry; + return 0; + } + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izi_noent = -1; + ip->i_entry = entry; + return 0; + } + ib = 1 << sp->s_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + bcopy(bp->b_data, dir, BLOCK_SIZE); + bqrelse(bp); + for (id=0; idi_noent = entry; + ip->i_entry = -1; + return 0; + } + entry++; + } + } + } + ip->i_noent = -1; + ip->i_entry = -1; + return ENOSPC; +} + +/* + * The size of a directory corresponds to the index+1 of the + * last entry (including all null entries between) times + * the size of a directory entry in bytes. + */ +static int +minix_dirsize(struct vnode *vp, u_long *last) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + unsigned long ind1[V2_INDIRECTS]; + union minix_block *mbp; + int ib, id, iz, error; + u_int32_t blk; + u_long count = 0; + + *last = count; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + *last = count; + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while (ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + *last = count; + } + bqrelse(bp); + } + } + return 0; +} + +/* + * Count the number of entries in a directory + */ +static int +minix_dircount(struct vnode *dvp, unsigned long *count) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + union minix_block *mbp; + int ib, id, iz, error; + + *count = 0; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + (*count) += 1; + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) + (*count) += 1; + } + bqrelse(bp); + } + } + return 0; +} + +static int +minix_dirmove(struct vnode *dvp, struct minix_direct *dirp, unsigned long count) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + unsigned long idc; + union minix_block *mbp; + int ib, id, iz, error; + + if (count < 2) + return EIO; + + idc = 0; + for (iz=0; izi_block[iz] == 0) + return 0; + ib = 1 << sp->s_zshift; + blk = dip->i_block[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) { + dirp[idc].d_ino = mbp->dir[id].d_ino; + strncpy(dirp[idc].d_name, mbp->dir[id].d_name, MINIX_NAME_MAX); + if (++idc == count) { + bqrelse(bp); + return 0; + } + } + } + bqrelse(bp); + } + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + bqrelse(bp); + + for (iz=0; izs_zshift; + blk = ind1[iz] << sp->s_zshift; + while(ib--) { + if ((error = minix_getblk(devvp,blk++,&bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=0; iddir[id].d_ino > 0) { + dirp[idc].d_ino = mbp->dir[id].d_ino; + strncpy(dirp[idc].d_name, mbp->dir[id].d_name, MINIX_NAME_MAX); + if (++idc == count) { + bqrelse(bp); + return 0; + } + } + } + bqrelse(bp); + } + } + return 0; +} +/* + * Clean everything out of a directory except '.' and '..'. + */ +static int +minix_dirclean(struct vnode *dvp) +{ + struct minix_inode *ip = VTOMI(dvp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + struct buf *bp; + u_int32_t ind1[V2_INDIRECTS]; + u_int32_t blk; + union minix_block *mbp; + int ib, ib0, id, iz, error; + + if (dip->i_block[0] == 0) /* This zone must always exist */ + return EIO; + + ip->i_blocks = 1 << sp->s_zshift; + dip->i_size = 2*DIR_ENTRY_SIZE; + + blk = dip->i_block[0] << sp->s_zshift; + ib = ip->i_blocks; + ib0 = ib - 1; + + while(ib--) { + if ((error = minix_getblk(devvp,blk++, &bp)) != 0) + return error; + mbp = MBLOCK(bp); + for (id=(ib==ib0)?2:0; iddir[id].d_ino = 0; + bwrite(bp); + } + + for (iz=1; izi_block[iz] == 0) + return 0; + if ((error = minix_dzalloc(sp, dip->i_block[iz])) != 0) + return error; + dip->i_block[iz] = 0; + } + + if (dip->i_block[V2_NR_DBLOCKS] == 0) + return 0; + + blk = dip->i_block[V2_NR_DBLOCKS] << sp->s_zshift; + if ((error = minix_getblk(devvp,blk,&bp)) != 0) + return error; + bcopy(bp->b_data, ind1, BLOCK_SIZE); + brelse(bp); + + if ((error = minix_dzalloc(sp, dip->i_block[V2_NR_DBLOCKS])) != 0) + return 0; + dip->i_block[V2_NR_DBLOCKS] = 0; + + for (iz=0; izi_dino); + int error, count, namelen; + int mindirsiz = sizeof(struct minix_direct); + + for (off=0; off<(off_t)dip->i_size; off+=mindirsiz) { + error = vn_rdwr(UIO_READ,ip->i_vnode,(caddr_t)dp, + mindirsiz, off, UIO_SYSSPACE, IO_NODELOCKED, + cred, &count, (struct proc*)0); + if (error || count !=0) + return 0; + if (dp->d_ino == 0) + continue; + namelen = strlen(dp->d_name); + if (namelen > 2) + return 0; + if (dp->d_name[0] != '.') + return 0; + if (namelen == 1 && dp->d_ino == ip->i_number) + continue; + if (dp->d_name[1] == '.' && dp->d_ino == parentino) + continue; + return 0; + } + return 1; +} +/* + * Check if source directory is in the path of the target directory. + * Target is supplied locked, source is unlocked. + * The target is always vput before returning. + */ +int +minix_checkpath(struct minix_inode *source, struct minix_inode *target, + struct ucred *cred) +{ + struct vnode *vp; + struct minix_dirtemplate dirbuf; + int error, rootino; + + vp = target->i_vnode; + if (target->i_number == source->i_number) { + error = EEXIST; + goto out; + } + rootino = ROOT_INO; + error = 0; + if (target->i_number == rootino) + goto out; + + /* + * Start at target and move to root, checking as we go. + */ + for (;;) { + if (vp->v_type != VDIR) { + error = ENOTDIR; + break; + } + error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, + sizeof(struct minix_dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED, cred, (int*)0, (struct proc*)0); + if (error != 0) + break; + if (dirbuf.dotdot_name[0] != '.' || + dirbuf.dotdot_name[1] != '.') { + error = ENOTDIR; + break; + } + if (dirbuf.dotdot_ino == source->i_number) { + error = EINVAL; + break; + } + if (dirbuf.dotdot_ino == rootino) /* Check until root */ + break; + vput(vp); + error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp); + if (error) { + vp = NULL; + break; + } + } +out: + if (vp != NULL) + vput(vp); + return error; +} +/* + * Rewrite an existing directory entry to point + * to the inode supplied. NOTE: This only works + * for the first block. + */ +int +minix_dirrewrite(struct minix_inode *dp, struct minix_inode *ip, + ino_t ino, int entry) +{ + struct buf *bp; + union minix_block *mbp; + int off, error; + off_t offset; + u_daddr_t bln; + + bln = entry / NR_DIR_ENTRIES; + off = entry % NR_DIR_ENTRIES; + + offset = (off_t)(bln*BLOCK_SIZE); + + if ((error = minix_blkatoff(dp->i_vnode, offset, NULL, &bp)) != 0) + return error; + + mbp = MBLOCK(bp); + mbp->dir[off].d_ino = ino; + + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + dp->i_flag |= IN_CHANGE | IN_UPDATE; + + return bwrite(bp); +} +/* + * The following was taken from FreeBSD's libc strtok.c and + * slightly modified to use to parse the path in minix_namei(). + */ +static char * +minix_strtok_r(char *s, char *delim, char **last) +{ + char *spanp; + int c, sc; + char *tok; + + if (s == NULL && (s = *last) == NULL) + { + return NULL; + } + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = (char *)delim; (sc = *spanp++) != 0; ) + { + if (c == sc) + { + goto cont; + } + } + + if (c == 0) /* no non-delimiter characters */ + { + *last = NULL; + return NULL; + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) + { + c = *s++; + spanp = (char *)delim; + do + { + if ((sc = *spanp++) == c) + { + if (c == 0) + { + s = NULL; + } + else + { + char *w = s - 1; + *w = '\0'; + } + *last = s; + return tok; + } + } + while (sc != 0); + } + /* NOTREACHED */ +} + +static char * +minix_strtok(char *s, char *delim) +{ + static char *last = NULL; + + return minix_strtok_r(s, delim, &last); +} diff -ruN sys.orig/fs/minixfs/minix_subr.c sys/fs/minixfs/minix_subr.c --- sys.orig/fs/minixfs/minix_subr.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_subr.c Fri Feb 28 21:04:32 2003 @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int minix_to_dirent_type(struct minix_inode*); +int minix_chown(struct vnode*,uid_t,gid_t,struct ucred*,struct proc*); +int minix_chmod(struct vnode*,int,struct ucred*,struct proc*); + +/* + * Allocate a new inode in the file system and + * return its vnode. + */ +int +minix_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) +{ + struct minix_inode *pip = VTOMI(pvp); + struct minix_super_block *sp = pip->i_su; + struct mount *mp = pip->i_mmp->mnx_mp; + struct minix_inode *ip; + struct minix_dinode *dip; + int ino, error; + + if ((error = minix_ialloc(sp, &ino)) != 0) + return error; + + if ((error = minix_vget(mp, ino, vpp)) != 0) { + (void)minix_dialloc(sp, ino); + return error; + } + + ip = VTOMI(*vpp); + ip->i_parent = pip->i_number; + ip->i_count = 1; + ip->i_blocks = 0; + ip->i_mode = mode; + ip->i_flag = IN_MODIFIED; + ip->i_su = sp; + + dip = &(ip->i_dino); + dip->i_mode = mode; /* XXX Check this! */ + dip->i_size = 0; + dip->i_nlinks = 1; + dip->i_uid = cred->cr_uid; + dip->i_gid = pip->i_dino.i_gid; + + (*vpp)->v_type = minix_get_vtype(ip); + + return 0; +} +/* + * Initialize the vnode associated with a new inode, handle aliased + * vnodes. + */ +int +minix_vinit(struct mount *mntp, vop_t **specops, + vop_t **fifoops, struct vnode **vpp) +{ + struct vnode *vp; + struct minix_inode *ip; + struct minix_dinode *dip; + int maj, min; + + vp = *vpp; + ip = VTOMI(vp); + dip = &(ip->i_dino); + + switch(vp->v_type) { + case VCHR: + case VBLK: + vp->v_op = specops; + maj = (dip->i_block[0] >> 8) & 0xff; + min = dip->i_block[0] & 0xff; + addaliasu(vp, dev2udev(makedev(maj,min))); + break; + case VFIFO: + vp->v_op = fifoops; + break; + default: + break; + } + + if (ip->i_number == ROOT_INO) + vp->v_flag |= VROOT; + + *vpp = vp; + + return 0; +} +/* + * Perform chown operation on inode ip; + * inode must be locked prior to call. + * Modified from ufs; PRISON_ROOT is not recognize by + * Minix at this time, so is a no-op. + */ +int +minix_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, + struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + uid_t ouid; + gid_t ogid; + int error = 0; + + if (uid == (uid_t)VNOVAL) + uid = dip->i_uid; + if (gid == (gid_t)VNOVAL) + gid = dip->i_gid; + /* + * If we don't own the file, are trying to change the owner + * of the file, or are not a member of the target group, + * the caller must be superuser or the call fails. + */ + if ((cred->cr_uid != dip->i_uid || uid != dip->i_uid || + (gid != dip->i_gid && !groupmember((gid_t)gid, cred))) && + (error = suser_xxx(cred, p, PRISON_ROOT))) + return (error); + ogid = dip->i_gid; + ouid = dip->i_uid; + + dip->i_gid = gid; + dip->i_uid = uid; + + ip->i_flag |= IN_CHANGE; + if (cred->cr_uid != 0 && (ouid != uid || ogid != gid)) + ip->i_mode &= ~(ISUID | ISGID); + + return 0; +} +/* + * Change the mode on a file. + * Inode must be locked before calling. + * Modified from ufs; there are some options that are + * not recognized by minix at this time: PRISON_ROOT, S_ISTXT. + */ +int +minix_chmod(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + int error; + + if (cred->cr_uid != dip->i_uid) { + error = suser_xxx(cred, p, PRISON_ROOT); + if (error) + return (error); + } + if (cred->cr_uid) { + if (vp->v_type != VDIR && (mode & S_ISTXT)) + return (EFTYPE); + if (!groupmember(dip->i_gid, cred) && (mode & ISGID)) + return (EPERM); + } + ip->i_mode &= ~ALLPERMS; + ip->i_mode |= (mode & ALLPERMS); + dip->i_mode = ip->i_mode; + ip->i_flag |= IN_CHANGE; + return 0; +} + +#include + +int +minix_to_dirent_type(struct minix_inode *ip) +{ + struct minix_dinode *dip = &(ip->i_dino); + int f_type; + + switch(dip->i_mode & I_TYPE) { + case I_NAMED_PIPE: + f_type = DT_FIFO; + break; + case I_CHAR_SPECIAL: + f_type = DT_CHR; + break; + case I_DIRECTORY: + f_type = DT_DIR; + break; + case I_BLOCK_SPECIAL: + f_type = DT_BLK; + break; + case I_REGULAR: + f_type = DT_REG; + break; + case I_LINK: + f_type = DT_LNK; + break; + case I_SOCK: + f_type = DT_SOCK; + break; + default: + f_type = DT_UNKNOWN; + break; + } + + return f_type; +} + +/* Returns ufs vnode type given a minix inode */ + +int +minix_get_vtype(struct minix_inode *ip) +{ + switch (ip->i_mode & I_TYPE) { + case I_DIRECTORY: + return VDIR; + case I_REGULAR: + return VREG; + case I_BLOCK_SPECIAL: + return VBLK; + case I_CHAR_SPECIAL: + return VCHR; + case I_NAMED_PIPE: + return VFIFO; + case I_LINK: + return VLNK; + case I_SOCK: + return VSOCK; + default: + /* + return VNON; + */ + break; + } + return VBAD; +} diff -ruN sys.orig/fs/minixfs/minix_ufs.c sys/fs/minixfs/minix_ufs.c --- sys.orig/fs/minixfs/minix_ufs.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_ufs.c Fri Feb 28 13:46:38 2003 @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This little bit of code needs to be separate from the rest of + * the Minix code because of name conflicts between minix.h and + * the ufs include files. + */ +#include +#include +#include +#include +#include +#include + +#include +#include + +ino_t ufs_parent_ino(struct mount*); +ino_t ufs_vnode_ino(struct vnode*); + +ino_t +ufs_parent_ino(struct mount *mp) +{ + struct vnode *vp = mp->mnt_vnodecovered; + struct inode *ip = (struct inode*)vp->v_data; + + return (ino_t)ip->i_number; +} + +ino_t +ufs_vnode_ino(struct vnode *vp) +{ + struct inode *ip = (struct inode*)vp->v_data; + + return (ino_t)ip->i_number; +} diff -ruN sys.orig/fs/minixfs/minix_vfsops.c sys/fs/minixfs/minix_vfsops.c --- sys.orig/fs/minixfs/minix_vfsops.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_vfsops.c Fri Feb 28 20:07:19 2003 @@ -0,0 +1,716 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * This file is modelel after both the ufs and ext2fs code. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Various locks used throughout */ + +int minix_inode_hash_lock; + +static int minix_mount(struct mount*, char*, caddr_t, + struct nameidata*, struct proc*); +static int minix_unmount(struct mount*, int, struct proc*); +static int minix_root(struct mount*, struct vnode**); +static int minix_statfs(struct mount*, struct statfs*, struct proc*); +static int minix_sync(struct mount*, int, struct ucred*, struct proc*); +static int minix_start(struct mount*, int, struct proc*); +static int minix_init(struct vfsconf*); +static int minix_uninit(struct vfsconf*); +ino_t ufs_parent_ino(struct mount*); +ino_t ufs_vnode_ino(struct vnode*); + +struct minix_args { + char *fspec; + struct export_args export; +}; + +MALLOC_DEFINE(M_MINIXMNT, "Minixfs mount", "Minixfs mount structure"); +MALLOC_DEFINE(M_MINIXNOD, "Minixfs node", "Minixfs vnode"); + +static int +minix_mount(struct mount *mp, char *path, caddr_t data, + struct nameidata *ndp, struct proc *p) +{ + struct minix_args args; + struct minixmount *mmp = NULL; + struct vnode *devvp, *vproot; + struct buf *bp; + struct minix_super_block *es; + struct ucred *cred = p->p_ucred; + int error = 0, ronly = 0, size; + u_daddr_t iblkn, zblkn; + long isize, ssize, zsize; + mode_t accessmode; + + if (p->p_ucred->cr_uid != 0) + return EACCES; + + if (mp->mnt_flag & MNT_UPDATE) + return EOPNOTSUPP; + + /* no asynchronous updates and no soft updates */ + + mp->mnt_flag &= ~(MNT_ASYNC | MNT_SOFTDEP); + + /*** FORCE READ-ONLY FOR DEBUGGING ***/ +/* + mp->mnt_flag |= MNT_RDONLY; +*/ + /*** FORCE NODEV and NOEXEC for safety ***/ + + mp->mnt_flag |= (MNT_NODEV | MNT_NOEXEC); + + error = copyin(data, (caddr_t)&args, sizeof(struct minix_args)); + if (error) + return error; + + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); + ndp->ni_vp = NULL; + if ((error = namei(ndp)) != 0) + return error; + NDFREE(ndp, NDF_ONLY_PNBUF); + + if (ndp->ni_vp != NULL) + devvp = ndp->ni_vp; + else { + printf("devvp is NULL!\n"); + return ENXIO; + } + + if (!vn_isdisk(devvp, &error)) { + printf("vn_isdisk error = %d\n",error); + goto out; + } + + if (vcount(devvp) < 1) { + printf("devvp: vcount < 1!\n"); + return ENXIO; + } + + /* + * Disallow multiple mounts of the same device. + * Disallow mounting of a device that is currently in use + * (except for root, which might share swap device for miniroot). + * Flush out any old buffers remaining from a previous use. + */ + + if ((error = vfs_mountedon(devvp)) != 0) { + printf("vfs_mountedon error\n"); + goto out; + } + + if (vcount(devvp) > 1 && devvp != rootvp) { + printf("vcount error\n"); + error = EBUSY; + goto out; + } + + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0); + VOP_UNLOCK(devvp, 0, p); + + if (error) { + printf("vinvalbuf error\n"); + goto out; + } + + /* + * If mount by non-root, then verify that the user has + * the necessary permissions on the device. + */ + if (cred->cr_uid != 0) { + accessmode = VREAD; + if ((mp->mnt_flag & MNT_RDONLY) == 0) + accessmode |= VWRITE; + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + if ((error = VOP_ACCESS(devvp, accessmode, cred, p)) != 0) { + vput(devvp); + return (error); + } + VOP_UNLOCK(devvp, 0, p); + } + + /* + * Only VMIO the backing device if the backing device is a real + * block device. This excludes the original MFS implementation. + * Note that it is optional that the backing device be VMIOed. This + * increases the opportunity for metadata caching. + */ + if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + vfs_object_create(devvp, p, p->p_ucred); + simple_lock(&devvp->v_interlock); + VOP_UNLOCK(devvp, LK_INTERLOCK, p); + } + + /*********************************/ + + ronly = (mp->mnt_flag & MNT_RDONLY) != 0; + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); + VOP_UNLOCK(devvp, 0, p); + + if (error) { + printf("VOP_OPEN error\n"); + goto out; + } + + if (devvp->v_rdev->si_iosize_max != 0) + mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; + if (mp->mnt_iosize_max > MAXPHYS) + mp->mnt_iosize_max = MAXPHYS; + + bp = NULL; + if ((error = bread(devvp, LSV2BLOCK, BLOCK_SIZE, NOCRED, &bp)) != 0) { + printf("bread error reading superblock: %d\n",error); + goto out; + } + + es = (struct minix_super_block *)bp->b_data; + + if (es->s_magic != SUPER_V2) { + printf("Invalid super block = 0x%x\n",es->s_magic); + error = EINVAL; + goto out; + } + + if ((mmp = malloc(sizeof(struct minixmount), M_MINIXMNT, M_WAITOK)) == NULL) { + error = ENOMEM; + goto out; + } + bzero(mmp, sizeof(struct minixmount)); + + mp->mnt_data = (qaddr_t)mmp; + + /* The superblock gets stored in mmp */ + + if ((mmp->mnx_su = malloc(sizeof(struct minix_super_block), + M_MINIXMNT, M_WAITOK)) == NULL) { + error = ENOMEM; + goto out; + } + + bcopy(es, mmp->mnx_su, sizeof(struct minix_super_block)); + + brelse(bp); + bp = NULL; + + /* Reset es to point to the stored super block */ + + es = mmp->mnx_su; + + /* Fill the in-core super with stuff */ + + es->s_firstinode = 2 + es->s_imap_blocks + es->s_zmap_blocks; + es->s_zoff = es->s_firstdatazone - 1; + es->s_version = 2; + es->s_dev = devvp->v_rdev; + es->s_devvp = devvp; + es->s_rdonly = ronly; + es->s_bsize = BLOCK_SIZE; + es->s_zsize = BLOCK_SIZE << es->s_zshift; + es->s_imnton = ufs_parent_ino(mp); + es->s_max_size = ((es->s_zones - es->s_zoff) << es->s_zshift)*BLOCK_SIZE; + + isize = blk_to_byte(es->s_imap_blocks); + zsize = blk_to_byte(es->s_zmap_blocks); + iblkn = byte_to_blkn(blk_to_byte(2)); + zblkn = byte_to_blkn(blk_to_byte(es->s_imap_blocks + 2)); + + /* Load the bitmaps into the in-core super */ + + es->s_ibmap = (u_int16_t*)malloc(isize, M_MINIXMNT, M_WAITOK); + if (es->s_ibmap == NULL) { + error = ENOMEM; + goto out; + } + es->s_zbmap = (u_int16_t*)malloc(zsize, M_MINIXMNT, M_WAITOK); + if (es->s_zbmap == NULL) { + error = ENOMEM; + free(es->s_ibmap, M_MINIXMNT); + goto out; + } + bzero(es->s_ibmap, isize); + bzero(es->s_zbmap, zsize); + es->imap_lock = 0l; + es->zmap_lock = 0l; + + if ((error = bread(devvp, iblkn, isize, NOCRED, &bp)) != 0) { + printf("bread error reading inode bitmap\n"); + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((caddr_t)bp->b_data, es->s_ibmap, isize); + brelse(bp); + bp = NULL; + + if ((error = bread(devvp, zblkn, zsize, NOCRED, &bp)) != 0) { + printf("bread error reading block bitmap\n"); + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((caddr_t)bp->b_data, es->s_zbmap, zsize); + brelse(bp); + bp = NULL; + + /* Finish filling mmp */ + + mmp->mnx_devvp = devvp; + mmp->mnx_dev = devvp->v_rdev; + mmp->mnx_mp = mp; + mmp->mnx_malloctype = M_MINIXNOD; + + /* Complete the mount */ + + mp->mnt_stat.f_fsid.val[0] = (long)dev2udev(devvp->v_rdev); + mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; + mp->mnt_maxsymlinklen = MINIX_MAXSYMLINKLEN; /* Max short symlink */ + mp->mnt_flag |= MNT_LOCAL; + + devvp->v_specmountpoint = mp; + + /**************/ + + /* Save "last mounted on" info for mount point (NULL pad)*/ + copyinstr( path, /* mount point*/ + mp->mnt_stat.f_mntonname, /* save area*/ + MNAMELEN - 1, /* max size*/ + &size); /* real size*/ + bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); + + /* Save "mounted from" info for mount point (NULL pad)*/ + copyinstr( args.fspec, /* device name*/ + mp->mnt_stat.f_mntfromname, /* save area*/ + MNAMELEN - 1, /* max size*/ + &size); /* real size*/ + bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + + mp->mnt_stat.f_type = mp->mnt_vfc->vfc_typenum; + mp->mnt_stat.f_owner = p->p_ucred->cr_uid; + mp->mnt_stat.f_flags = mp->mnt_flag; + + minix_statfs(mp, &mp->mnt_stat, p); + + /* minix_root increments usecount as well as locks the vnode */ + + es->s_root = (struct minix_inode*)NULL; + + if ((error = minix_root(mp, &vproot)) != 0) { + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + + ssize = sizeof(struct minix_inode); + + es->s_root = (struct minix_inode*)malloc(ssize, M_MINIXMNT, M_WAITOK); + if (es->s_root == NULL) { + free(es->s_ibmap, M_MINIXMNT); + free(es->s_zbmap, M_MINIXMNT); + goto out; + } + bcopy((char*)vproot->v_data, es->s_root, ssize); + vput(vproot); + + es->s_root->i_parent = es->s_imnton; + + return 0; + +out: + devvp->v_specmountpoint = NULL; + if (bp) + brelse(bp); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, p); + if (vcount(devvp) > 0) + vrele(devvp); + if (mmp) { + if (mmp->mnx_su) + free(mmp->mnx_su, M_MINIXMNT); + free(mmp, M_MINIXMNT); + } + + mp->mnt_data = (qaddr_t)0; + + return error; +} + +static int +minix_unmount(struct mount *mp, int mntflags, struct proc *p) +{ + struct minixmount *mmp = (struct minixmount*)(mp->mnt_data); + struct minix_inode *rip = mmp->mnx_su->s_root; + struct vnode *devvp; + int error, ronly, flags; + + flags = 0; + if (mntflags & MNT_FORCE) + flags |= FORCECLOSE; + + /* Flush all the vnodes associated with mp. */ + + if ((error = vflush(mp, 0, flags)) != 0) + return error; + + cache_purgevfs(mp); + + devvp = mmp->mnx_devvp; + + /* Sync up metadata */ + + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_FSYNC(devvp, p->p_ucred, MNT_WAIT, p); + VOP_UNLOCK(devvp, 0, p); + + minix_ihashrem(rip); + + devvp->v_specmountpoint = NULL; + vinvalbuf(devvp, V_SAVE, NOCRED, p, 0, 0); + ronly =(mp->mnt_flag & MNT_RDONLY) != 0; + error = VOP_CLOSE(devvp,ronly ? FREAD : FREAD|FWRITE,NOCRED,p); + vrele(devvp); + + free(mmp->mnx_su->s_ibmap, M_MINIXMNT); + free(mmp->mnx_su->s_zbmap, M_MINIXMNT); + if (mmp->mnx_su->s_root) + free(mmp->mnx_su->s_root, M_MINIXMNT); + free(mmp->mnx_su, M_MINIXMNT); + free(mmp, M_MINIXMNT); + mp->mnt_data = (qaddr_t)0; + mp->mnt_flag &= ~MNT_LOCAL; + + return error; +} + +static int +minix_root(struct mount *mp, struct vnode **vpp) +{ + return minix_vget(mp, (ino_t)ROOT_INO, vpp); +} + +static int +minix_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) +{ + struct minixmount *mmp; + struct minix_super_block *sp; + size_t size; + + mmp = (struct minixmount*)(mp->mnt_data); + sp = mmp->mnx_su; + + sbp->f_bsize = BLOCK_SIZE; + sbp->f_iosize = BLOCK_SIZE; + sbp->f_blocks = (sp->s_zones - sp->s_zoff) << sp->s_zshift; + sbp->f_bfree = (minix_free_zone_count(sp) << sp->s_zshift); + sbp->f_ffree = minix_free_inode_count(sp); + sbp->f_files = sp->s_ninodes; + sbp->f_bavail = sbp->f_bfree; + copystr("minixfs", sbp->f_fstypename,8, &size); + + if (sbp != &mp->mnt_stat) { + sbp->f_type = mp->mnt_vfc->vfc_typenum; + sbp->f_owner = mp->mnt_stat.f_owner; + sbp->f_flags = mp->mnt_flag; + bcopy((caddr_t)mp->mnt_stat.f_mntonname, + (caddr_t)&sbp->f_mntonname[0], MNAMELEN); + bcopy((caddr_t)mp->mnt_stat.f_mntfromname, + (caddr_t)&sbp->f_mntfromname[0], MNAMELEN); + } + + return 0; +} +/* + * Convert an inode number into a locked vnode. + */ +int +minix_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +{ + struct minix_super_block *su; + struct minix_inode *ip; + struct minixmount *mmp; + struct vnode *vp; + dev_t dev; + int error; + + *vpp = NULL; + mmp = (struct minixmount*)(mp->mnt_data); + dev = mmp->mnx_dev; + su = mmp->mnx_su; + + /* Look for the vnode in the hash table first */ + +restart: + if ((*vpp = minix_ihashget(dev, ino)) != NULL) { + + vp = *vpp; + ip = VTOMI(vp); + + (void)minix_vinit(mp, minix_specop_p, minix_fifoop_p, vpp); + + if (ino == ROOT_INO) + vp->v_flag |= VROOT; + + return 0; + } + + if (minix_inode_hash_lock) { + while (minix_inode_hash_lock) { + minix_inode_hash_lock = -1; + tsleep(&minix_inode_hash_lock, PVM, "mnxfsgt", 0); + } + goto restart; + } + minix_inode_hash_lock = 1; + + /* Not in the hash table; so make a new vnode/inode pair. */ + + MALLOC(ip, struct minix_inode*,sizeof(struct minix_inode), + M_MINIXNOD, M_WAITOK); + + if ((error = minix_iget(mmp->mnx_devvp, su, (mino_t)ino, ip)) != 0) { + FREE(ip, M_MINIXNOD); + *vpp = NULL; + return error; + } + + /* Allocate a new vnode */ + + error = getnewvnode(VT_MINIXFS, mp, minix_vnodeop_p, &vp); + if (error) { + if (minix_inode_hash_lock < 0) + wakeup(&minix_inode_hash_lock); + minix_inode_hash_lock = 0; + *vpp = NULL; + FREE(ip, M_MINIXNOD); + return (error); + } + + vp->v_data = ip; /* connect vnode to inode */ + + /* Set up lock sharing in the stack of vnodes */ + + lockinit(&ip->i_lock, PINOD, "minix_inode", VLKTIMEOUT, LK_CANRECURSE); + vp->v_vnlock = &ip->i_lock; + + /* Load up the inode with info */ + + ip->i_vnode = vp; + ip->i_dev = dev; /* Specinfo pointer */ + ip->i_su = su; + ip->i_number = ino; + ip->i_parent = 0; /* Don't know this yet */ + ip->i_mmp = mmp; + ip->i_flag = 0; + ip->i_mode = ip->i_dino.i_mode; + ip->i_blocks = minix_num_blocks(ip->i_mode, ip->i_dino.i_size, su->s_zshift); + ip->i_count = 1; + ip->i_entry = 0; + ip->i_noent = 0; + + /* Put the inode into the hash table */ + + minix_ihashins(ip); /* This leads to panics after remounts! */ + + /* We just lock the inode here and forget about hashing for now. */ + + lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, curproc); + + if (minix_inode_hash_lock < 0) + wakeup(&minix_inode_hash_lock); + + minix_inode_hash_lock = 0; + + /* Put more good stuff into the vnode */ + + vp->v_type = minix_get_vtype(ip); + + if (ino == ROOT_INO) { + vp->v_flag |= VROOT; + ip->i_flag |= VROOT; + } + + error = minix_vinit(mp, minix_specop_p, minix_fifoop_p, &vp); + if (error) { + minix_ihashrem(ip); + FREE(ip, M_MINIXNOD); + vput(vp); + *vpp = NULL; + return error; + } + + /* Reference the device vnode */ + + VREF(su->s_devvp); + + *vpp = vp; + + return 0; +} + +static int +minix_sync(struct mount *mp, int waitfor, struct ucred *cred, struct proc *p) +{ + struct vnode *vp, *nvp; + struct minix_inode *ip; + struct minixmount *mmp; + struct minix_super_block *su; + int error, allerror = 0; + + mmp = (struct minixmount*)(mp->mnt_data); + su = mmp->mnx_su; + + /* + * Write back each (modified) inode. + */ + simple_lock(&mntvnode_slock); +loop: + for(vp=TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nvp) { + if (vp->v_mount != mp) + goto loop; + nvp = TAILQ_NEXT(vp, v_nmntvnodes); + ip = vp->v_data; + if (vp->v_type == VNON || ((ip->i_flag * + (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 && + TAILQ_EMPTY(&vp->v_dirtyblkhd))) + continue; + if (vp->v_type != VCHR) { + simple_unlock(&mntvnode_slock); + error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT, p); + if (error) { + simple_lock(&mntvnode_slock); + if (error == ENOENT) + goto loop; + } else { + if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) + allerror = error; + VOP_UNLOCK(vp, 0, p); + vrele(vp); + simple_lock(&mntvnode_slock); + } + + } else { + /* + * We must reference the vp to prevent it from + * getting ripped out from under UFS_UPDATE, since + * we are not holding a vnode lock. XXX why aren't + * we holding a vnode lock? + */ + VREF(vp); + simple_unlock(&mntvnode_slock); + minix_update(vp); + vrele(vp); + simple_lock(&mntvnode_slock); + } + if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp) + goto loop; + } + simple_unlock(&mntvnode_slock); + /* + * Force stale file system control information to be flushed. + */ + if (waitfor != MNT_LAZY) { + if (mmp->mnx_mp->mnt_flag & MNT_SOFTDEP) + waitfor = MNT_NOWAIT; + vn_lock(mmp->mnx_devvp, LK_EXCLUSIVE | LK_RETRY, p); + if ((error = VOP_FSYNC(mmp->mnx_devvp, cred, waitfor, p)) != 0) + allerror = error; + VOP_UNLOCK(mmp->mnx_devvp, 0, p); + } + return 0; +} + +static int +minix_start(struct mount *mp, int flags, struct proc *p) +{ + return 0; +} + +/* + * minix_init is called by kld when the minixfs is loaded. + */ +static int +minix_init(struct vfsconf *vfsp) +{ + static int done = 0; + + if (done == 1) + return 0; + + minix_inode_hash_lock = 0; + minix_ihashinit(); + done = 1; + + return 0; +} + +/* + * minix_uninit is called by kld when the minixfs is unloaded. + */ +static int +minix_uninit(struct vfsconf *vfsp) +{ + minix_ihashuninit(); + return 0; +} + +static struct vfsops minixfs_vfsops = { + minix_mount, + minix_start, + minix_unmount, + minix_root, + vfs_stdquotactl, + minix_statfs, + minix_sync, + minix_vget, + vfs_stdfhtovp, + vfs_stdcheckexp, + vfs_stdvptofh, + minix_init, + minix_uninit, + vfs_stdextattrctl, +}; + +VFS_SET(minixfs_vfsops, minixfs, 0); diff -ruN sys.orig/fs/minixfs/minix_vnops.c sys/fs/minixfs/minix_vnops.c --- sys.orig/fs/minixfs/minix_vnops.c Wed Dec 31 16:00:00 1969 +++ sys/fs/minixfs/minix_vnops.c Fri Feb 28 20:24:43 2003 @@ -0,0 +1,1722 @@ +/*- + * Copyright (c) 2003 Ed Alley: wea@llnl.gov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * This file has borrowed heavily from FreeBSD's ufs and ext2fs + * implementations. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +int minix_lookup(struct vop_cachedlookup_args*); +int minix_to_dirent_type(struct minix_inode*); +int minix_chown(struct vnode*,uid_t,gid_t,struct ucred*,struct proc*); +int minix_chmod(struct vnode*,int,struct ucred*,struct proc*); + +static int minix_fsync(struct vop_fsync_args*); +static int minix_inactive(struct vop_inactive_args*); +static int minix_reclaim(struct vop_reclaim_args*); +static int minix_readdir(struct vop_readdir_args*); +static int minix_readlink(struct vop_readlink_args*); +static int minix_symlink(struct vop_symlink_args*); +static int minix_open(struct vop_open_args*); +static int minix_close(struct vop_close_args*); +static int minix_create(struct vop_create_args*); +static int minix_remove(struct vop_remove_args*); +static int minix_link(struct vop_link_args*); +static int minix_mkdir(struct vop_mkdir_args*); +static int minix_rmdir(struct vop_rmdir_args*); +static int minix_read(struct vop_read_args*); +static int minix_write(struct vop_write_args*); +static int minix_bmap(struct vop_bmap_args*); +static int minix_getpages(struct vop_getpages_args*); +static int minix_putpages(struct vop_putpages_args*); +static int minix_access(struct vop_access_args*); +static int minix_getattr(struct vop_getattr_args*); +static int minix_rename(struct vop_rename_args*); +static int minix_setattr(struct vop_setattr_args*); +static int minix_mknod(struct vop_mknod_args*); +static int minixfifo_read(struct vop_read_args*); +static int minixfifo_write(struct vop_write_args*); +static int minixfifo_close(struct vop_close_args*); +static int minix_pathconf(struct vop_pathconf_args*); + +#define PRINTD(x) printf(x); +#undef PRINTD(x) +#define PRINTD(x) + +#undef MINIX_DEBUG + +vop_t **minix_vnodeop_p; +static struct vnodeopv_entry_desc minix_vnodeop_entries[] = { + { &vop_default_desc, (vop_t *) vop_defaultop }, + { &vop_cachedlookup_desc, (vop_t *) minix_lookup }, + { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_read_desc, (vop_t *) minix_read }, + { &vop_readdir_desc, (vop_t *) minix_readdir }, + { &vop_readlink_desc, (vop_t *) minix_readlink }, + { &vop_symlink_desc, (vop_t *) minix_symlink }, + { &vop_bmap_desc, (vop_t *) minix_bmap }, + { &vop_write_desc, (vop_t *) minix_write }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_setattr_desc, (vop_t *) minix_setattr }, + { &vop_open_desc, (vop_t *) minix_open }, + { &vop_close_desc, (vop_t *) minix_close }, + { &vop_create_desc, (vop_t *) minix_create }, + { &vop_remove_desc, (vop_t *) minix_remove }, + { &vop_link_desc, (vop_t *) minix_link }, + { &vop_mkdir_desc, (vop_t *) minix_mkdir }, + { &vop_rmdir_desc, (vop_t *) minix_rmdir }, + { &vop_rename_desc, (vop_t *) minix_rename }, + { &vop_mknod_desc, (vop_t *) minix_mknod }, + { &vop_pathconf_desc, (vop_t *) minix_pathconf }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_poll_desc, (vop_t *) vop_stdpoll }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { &vop_getpages_desc, (vop_t *) minix_getpages }, + { &vop_putpages_desc, (vop_t *) minix_putpages }, + { NULL, NULL } +}; + +static struct vnodeopv_desc minix_vnodeop_opv_desc = +{ &minix_vnodeop_p, minix_vnodeop_entries }; + +/* We do not implement read or write of device files for safety */ + +vop_t **minix_specop_p; +static struct vnodeopv_entry_desc minix_specop_entries[] = { + { &vop_default_desc, (vop_t *) vop_defaultop }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { NULL, NULL} +}; +static struct vnodeopv_desc minix_specop_opv_desc = + { &minix_specop_p, minix_specop_entries }; + +vop_t **minix_fifoop_p; +static struct vnodeopv_entry_desc minix_fifoop_entries[] = { + { &vop_default_desc, (vop_t *) fifo_vnoperate }, + { &vop_fsync_desc, (vop_t *) minix_fsync }, + { &vop_inactive_desc, (vop_t *) minix_inactive }, + { &vop_reclaim_desc, (vop_t *) minix_reclaim }, + { &vop_access_desc, (vop_t *) minix_access }, + { &vop_getattr_desc, (vop_t *) minix_getattr }, + { &vop_setattr_desc, (vop_t *) minix_setattr }, + { &vop_read_desc, (vop_t *) minixfifo_read }, + { &vop_write_desc, (vop_t *) minixfifo_write }, + { &vop_close_desc, (vop_t *) minixfifo_close }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, + { NULL, NULL } +}; + +static struct vnodeopv_desc minix_fifoop_opv_desc = + { &minix_fifoop_p, minix_fifoop_entries }; + +VNODEOP_SET(minix_vnodeop_opv_desc); +VNODEOP_SET(minix_specop_opv_desc); +VNODEOP_SET(minix_fifoop_opv_desc); + +/* + * Called by vput(), vrele(), if usecount drops to zero. + * Also called by vclean() if use count has + * dropped to zero. + * This routine should clean release buffers associated + * with the vnode/inode back to the buffer cache, + * however, the vnode maintains its association with + * the filesystem. + */ + +/* + * Vnode usecount has dropped to zero; write or delete it. + * The node is locked when inactive is called, and is + * unlocked by inactive before it returns. + * Typically called from vrele, vput, vclean. + */ + +static int +minix_inactive(struct vop_inactive_args *ap) + /* + struct vop_inactive_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct proc *p = ap->a_p; + int mode, error = 0; + + PRINTD("Entering: minix_inactive\n") + + if (ip->i_mode == 0) + goto out; + + if (ip->i_nlink <= 0) { + error = minix_truncate(vp, (off_t)0, IO_SYNC, NOCRED, p); + ip->i_dev = 0; + mode = ip->i_mode; + ip->i_mode = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + minix_vfree(vp, ip->i_number, mode); + } + if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) + minix_update(vp); +out: + VOP_UNLOCK(vp, 0, p); + /* + * If we are done with the inode, reclaim it + * so that it can be reused immediately. + */ + if (ip->i_mode == 0) + vrecycle(vp, (struct simplelock *)0, p); + + return error; +} + +/* + * Called by vclean() after the buffers associated with the + * vnode have been released. VOP_INACTIVE is called if the + * usercount is zero to clean out the vnode. + * This routine actually frees the inode associated with + * the vnode to disassociate it from the file system. + */ +static int +minix_reclaim(struct vop_reclaim_args *ap) + /* + struct vop_reclaim_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct minix_super_block *sp = ip->i_su; + + minix_ihashrem(ip); + cache_purge(vp); + vrele(sp->s_devvp); + + FREE(ip, M_MINIXNOD); /* release inode space */ + vp->v_data = 0; + + return 0; +} + +static int +minix_fsync(struct vop_fsync_args *ap) + /* + struct vop_fsync_args { + struct vnode *a_vp; + struct ucred *a_cred; + int a_waitfor; + struct proc *a_p; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct buf *bp, *nbp; + int s; + +loop: + s = splbio(); + for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { + nbp = TAILQ_NEXT(bp, b_vnbufs); +/* + * Ignore buffers that are already being written. + */ + if (bp->b_flags & B_WRITEINPROG) + continue; +/* + * Make sure the buffer is dirty. + */ + if ((bp->b_flags & B_DELWRI) == 0) + panic("minix_fsync: not dirty"); + + vfs_bio_awrite(bp); + splx(s); + goto loop; + } + splx(s); + + if (ap->a_waitfor == MNT_WAIT) { + s = splbio(); + while (vp->v_numoutput) { + vp->v_flag |= VBWAIT; + tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "mnxfsn",0); + } + splx(s); +#ifdef DIAGNOSTIC + if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) { + vprint("minix_fsync: dirty", vp); + goto loop; + } +#endif + } + splx(s); + + ip->i_flag |= IN_UPDATE; + return minix_update(vp); +} + +static int +minix_access(struct vop_access_args *ap) +/* + struct vop_access_args { + struct vnode *a_vp; + int a_mode; + struct ucred *a_cred; + struct proc *a_p; + }; +*/ +{ + struct vnode *vp = ap->a_vp; + struct ucred *cred = ap->a_cred; + int mode = ap->a_mode; + + struct minix_dinode *dip; + struct minix_inode *ip; + + ip = VTOMI(vp); + dip = &ip->i_dino; + + return minix_dinode_access(dip, mode, cred, ip->i_su); +} + +static int +minix_getattr(struct vop_getattr_args *ap) + /* + struct vop_getattr_args { + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct vattr *vap = ap->a_vap; + struct minix_dinode *dip = &(ip->i_dino); + + minix_itimes(vp); + + vap->va_fsid = dev2udev(ip->i_dev); + vap->va_fileid = ip->i_number; + vap->va_mode = ip->i_mode & ALL_MODES; /* Minix and ufs agree here */ + vap->va_nlink = dip->i_nlinks; + vap->va_uid = dip->i_uid; + vap->va_gid = dip->i_gid; + vap->va_rdev = dip->i_block[0]; + vap->va_size = dip->i_size; + vap->va_atime.tv_sec = dip->i_atime; + vap->va_atime.tv_nsec = (dip->i_atime)*1000000000; + vap->va_mtime.tv_sec = dip->i_mtime; + vap->va_mtime.tv_nsec = (dip->i_mtime)*1000000000; + vap->va_ctime.tv_sec = dip->i_ctime; + vap->va_ctime.tv_nsec = (dip->i_ctime)*1000000000; + vap->va_flags = 0; /* Minix has no chflags command */ + vap->va_gen = 0; /* I don't know what this is */ + vap->va_blocksize = BLOCK_SIZE; + vap->va_bytes = ((dip->i_size + BLOCK_SIZE-1) & ~(BLOCK_SIZE-1)) + + BLOCK_SIZE; + vap->va_filerev = 0; /* NFS is not relevant yet */ +/* vap->va_type = minix_get_vtype(ip); */ + vap->va_type = IFTOVT(ip->i_mode); /* IFTOVT() also works for minix */ + + return 0; +} + +static int +minix_setattr(struct vop_setattr_args *ap) + /* + struct vop_setattr_args { + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; + } + */ +{ + struct vattr *vap = ap->a_vap; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct ucred *cred = ap->a_cred; + struct proc *p = ap->a_p; + int error; + /* + * Check for unsettable attributes. + */ + if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || + (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || + (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || + ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { + return EINVAL; + } + + /* Minix doesn't have chflags capability */ + + if (vap->va_flags != VNOVAL) + printf("minix_setattr: FLAGS NOT SET\n"); + /* + * Go through the fields and update iff not VNOVAL. + */ + if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + if ((error = minix_chown(vp, vap->va_uid, vap->va_gid, cred, p)) != 0) + return error; + } + if (vap->va_size != VNOVAL) { + /* + * Disallow write attempts on read-only file systems; + * unless the file is a socket, fifo, or a block or + * character device resident on the file system. + */ + switch (vp->v_type) { + case VDIR: + return EISDIR; + case VLNK: + case VREG: + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + break; + default: + break; + } + if ((error = minix_truncate(vp, vap->va_size, IO_SYNC, cred, p)) != 0) + return error; + } + if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + if (cred->cr_uid != dip->i_uid && + (error = suser_xxx(cred, p, PRISON_ROOT)) && + ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || + (error = VOP_ACCESS(vp, VWRITE, cred, p)))) + return error; + if (vap->va_atime.tv_sec != VNOVAL) + ip->i_flag |= IN_ACCESS; + if (vap->va_mtime.tv_sec != VNOVAL) + ip->i_flag |= IN_CHANGE | IN_UPDATE; + minix_itimes(vp); + if (vap->va_atime.tv_sec != VNOVAL) { + dip->i_atime = vap->va_atime.tv_sec; + } + if (vap->va_mtime.tv_sec != VNOVAL) { + dip->i_mtime = vap->va_mtime.tv_sec; + } + if ((error = minix_update(vp)) != 0) + return error; + } + error = 0; + if (vap->va_mode != (mode_t)VNOVAL) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + error = minix_chmod(vp, (int)vap->va_mode, cred, p); + } + + return error; +} + +static int +minix_readdir(struct vop_readdir_args *ap) + /* + struct vop_readdir_args { + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; + int *a_eofflag; + int *ncookies; + u_long **a_cookies; + }; + */ +{ + struct uio *uio = ap->a_uio; + int count, lost, error, err; + struct vnode *vp = ap->a_vp; + struct vnode *devvp; + struct minix_inode in, *ip = VTOMI(vp); + struct minix_super_block *sp; + struct mount *mp = vp->v_mount; + struct minixmount *mmp; + + struct minix_direct *edp, *dp; + int ncookies; + struct dirent dstdp; + struct uio auio; + struct iovec aiov; + caddr_t dirbuf; + int DIRBLKSIZ = BLOCK_SIZE; + int smdsize = sizeof(struct minix_direct); + int readcnt; + off_t startoffset = uio->uio_offset; + + mmp = (struct minixmount*)mp->mnt_data; + sp = mmp->mnx_su; + devvp = mmp->mnx_devvp; + + count = uio->uio_resid; + /* + * Make sure we don't return partial entries. + */ + if (count <= ((uio->uio_offset + count) & (DIRBLKSIZ -1))) + return EINVAL; + count -= (uio->uio_offset + count) & (DIRBLKSIZ -1); + lost = uio->uio_resid - count; + uio->uio_resid = count; + uio->uio_iov->iov_len = count; + + auio = *uio; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_resid = count; + auio.uio_segflg = UIO_SYSSPACE; + aiov.iov_len = count; + MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); + aiov.iov_base = dirbuf; + if ((error = VOP_READ(vp, &auio, 0, ap->a_cred)) == 0) { + readcnt = count - auio.uio_resid; + edp = (struct minix_direct *)&dirbuf[readcnt]; + ncookies = 0; + bzero(&dstdp, offsetof(struct dirent, d_name)); + for (dp = (struct minix_direct *)dirbuf; + !error && uio->uio_resid > 0 && dp < edp; ) { + /* + * Minix directory entries: + * - the name is NUL-terminated except for max length name. + * - no file type and no namelength. + * - so we get the file type from the inode + * - and the namelength from strlen(). + * - The record size for each entry is calculated + * - from GENERIC_DIRSIZ(). + */ + bzero(dstdp.d_name, MAXNAMLEN+1); + if (dp->d_ino > 0) { + dstdp.d_fileno = dp->d_ino; + if ((err = minix_iget(devvp,sp,dp->d_ino,&in)) != 0) + return err; + dstdp.d_type = minix_to_dirent_type(&in); + strncpy(dstdp.d_name, dp->d_name, MINIX_NAME_MAX); + dstdp.d_name[MINIX_NAME_MAX] = '\0'; + dstdp.d_namlen = strlen(dstdp.d_name); + dstdp.d_reclen = GENERIC_DIRSIZ(&dstdp); + } else { + dstdp.d_fileno = 0; + dstdp.d_type = DT_UNKNOWN; + dstdp.d_namlen = 0; + dstdp.d_name[0] = '\0'; + dstdp.d_reclen = GENERIC_DIRSIZ(&dstdp); + } + + if(dstdp.d_reclen <= uio->uio_resid) { + if (dstdp.d_fileno > 0) /* Only move entries that are valid */ + error = uiomove((caddr_t)&dstdp, dstdp.d_reclen, uio); + else { /* Invalid entry so go to the next entry */ + error = 0; + } + if (!error) + ncookies++; + } else + break; + + dp++; + } + /* we need to correct uio_offset */ + uio->uio_offset = startoffset + (caddr_t)dp - dirbuf; + + if (!error && ap->a_ncookies != NULL) { + u_long *cookiep, *cookies, *ecookies; + off_t off; + + if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) + panic("minix_readdir: unexpected uio from NFS server"); + MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, + M_WAITOK); + off = startoffset; + for (dp = (struct minix_direct *)dirbuf, + cookiep = cookies, ecookies = cookies + ncookies; + cookiep < ecookies; + dp = (struct minix_direct *)((caddr_t) dp + smdsize)) { + off += smdsize; + *cookiep++ = (u_long) off; + } + *ap->a_ncookies = ncookies; + *ap->a_cookies = cookies; + } + } + FREE(dirbuf, M_TEMP); + uio->uio_resid += lost; + if (ap->a_eofflag) + *ap->a_eofflag = ip->i_dino.i_size <= uio->uio_offset; + return error; +} +/* + * Make a symbolic link; follows ufs treatment. + * + * Symbolic links are not supported in Minix 2.0 + * but are useful in FreeBSD for amoung other things + * running Emacs on a file in the Minixfs. :) + */ +static int +minix_symlink(struct vop_symlink_args *ap) + /* + struct vop_symlink_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + char *a_target; + }; + */ +{ + struct vnode *vp, **vpp = ap->a_vpp; + struct minix_inode *ip; + int len, error; + + error = minix_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, + vpp, ap->a_cnp); + if (error) + return error; + + vp = *vpp; + len = strlen(ap->a_target); + if (len > MINIX_MAXSYMLINK) + return ENAMETOOLONG; + if (len < vp->v_mount->mnt_maxsymlinklen) { + ip = VTOMI(vp); + bzero((char*)ip->i_shortlink, MINIX_MAXSYMLINKLEN); + bcopy(ap->a_target, (char*)ip->i_shortlink, len); + ip->i_dino.i_size = len; + ip->i_blocks = 0; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + } else + error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0, + UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int*)0, + (struct proc*)0); + if (error) + vput(vp); + + cache_purge(ap->a_dvp); + return minix_update(vp); +} +/* + * Read a symbolic link; follows ufs treatment + */ +static int +minix_readlink(struct vop_readlink_args *ap) + /* + struct vop_reaklink_args { + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = (struct minix_inode*)vp->v_data; + int isize; + + isize = ip->i_dino.i_size; + if (isize < vp->v_mount->mnt_maxsymlinklen) { + uiomove((char*)ip->i_shortlink, isize, ap->a_uio); + return 0; + } + return VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred); +} + +static int +minix_bmap(struct vop_bmap_args *ap) + /* + struct vop_bmap_args { + struct vnode *a_vp; + struct daddr_t a_bn; + struct vnode **a_vpp; + struct daddr_t *a_bnp; + int *a_runp; + int *a_runb; + }; + */ +{ + struct minixmount *mmp; + + if (ap->a_vpp != NULL) { + mmp = (struct minixmount*)(ap->a_vp->v_mount->mnt_data); + *ap->a_vpp = mmp->mnx_devvp; + } + if (ap->a_bnp == NULL) + return 0; + + if (ap->a_runb != NULL) /* No cluster reads */ + *ap->a_runb = 0; + + return minix_bmapfs(ap->a_vp, ap->a_bn, ap->a_bnp, ap->a_runp); +} +static int +minix_open(struct vop_open_args *ap) +{ + return 0; +} +static int +minix_close(struct vop_close_args *ap) +{ + struct vnode *vp = ap->a_vp; + + simple_lock(&vp->v_interlock); + if (vp->v_usecount > 1) + minix_itimes(vp); + simple_unlock(&vp->v_interlock); + + return 0; +} +/* + * Vnode op for reading. + */ +static int +minix_read(struct vop_read_args *ap) + /* + struct vop_read_args { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct uio *uio = ap->a_uio; + + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + + struct buf *bp; + off_t bytesinfile; + u_daddr_t lbn, pbn; + long size, xfersize, blkoffset; + int error, orig_resid; + + size = BLOCK_SIZE; + + orig_resid = uio->uio_resid; + for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { + bytesinfile = (off_t)dip->i_size - uio->uio_offset; + if (bytesinfile <= 0) + break; + + lbn = uio->uio_offset / size; + blkoffset = uio->uio_offset - lbn * size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (bytesinfile < xfersize) + xfersize = bytesinfile; + + if ((error = VOP_BMAP(vp, lbn, NULL, &pbn, NULL, NULL)) != 0) + return error; + + if (pbn < 0) + return EIO; + + if ((error = bread(devvp, pbn, size, NOCRED, &bp)) != 0) { + brelse(bp); + bp = NULL; + break; + } + + /* + * We should only get non-zero b_resid when an I/O error + * has occurred, which should cause us to break above. + * However, if the short read did not cause an error, + * then we want to ensure that we do not uiomove bad + * or uninitialized data. + */ + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) + break; + xfersize = size; + } + + error = uiomove((char *)bp->b_data+blkoffset, (int)xfersize, uio); + if (error) + break; + + bqrelse(bp); + } + if (bp != NULL) + bqrelse(bp); + + if (orig_resid > 0 && (error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { + ip->i_flag |= IN_ACCESS; + (void)minix_update(vp); + } + + return error; +} +/* + * Vnode op for writing. + */ +static int +minix_write(struct vop_write_args *ap) + /* + struct vop_write_args { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } + */ +{ + struct vnode *vp = ap->a_vp; + struct uio *uio = ap->a_uio; + struct ucred *cred = ap->a_cred; + int ioflag = ap->a_ioflag; + struct buf *bp; + struct minix_inode *ip = VTOMI(vp); + struct minix_dinode *dip = &(ip->i_dino); + struct minix_super_block *sp = ip->i_su; + struct vnode *devvp = sp->s_devvp; + u_daddr_t lbn, pbn; + off_t osize; + long size, resid, blkoffset, xfersize = 0; + int flags, error; + + osize = (off_t)dip->i_size; + size = BLOCK_SIZE; + resid = uio->uio_resid; + + if (ioflag & IO_SYNC) + flags = B_SYNC; + else + flags = 0; + + for (error = 0; uio->uio_resid > 0;) { + lbn = uio->uio_offset/size; + blkoffset = uio->uio_offset - lbn*size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + + flags |= B_CLRBUF; /* All the time */ + + if (uio->uio_offset + xfersize > dip->i_size) { + vnode_pager_setsize(vp, (vm_ooffset_t)(uio->uio_offset + xfersize)); + if ((error = minix_balloc(vp, lbn, &bp)) != 0) + break; + } else { + if ((error = minix_bmapfs(vp, lbn, &pbn, NULL)) != 0) + break; + if ((error = bread(devvp, pbn, BLOCK_SIZE, NOCRED, &bp)) != 0) + break; + } + + if (uio->uio_offset + xfersize > dip->i_size) { + dip->i_size = uio->uio_offset + xfersize; + ip->i_blocks = minix_num_blocks(ip->i_mode, dip->i_size, sp->s_zshift); + } + + error = uiomove((char*)bp->b_data+blkoffset, (int)xfersize, uio); + + if (ioflag & IO_VMIO) + bp->b_flags |= B_RELBUF; + + if (ioflag & IO_SYNC) + bwrite(bp); + else if (xfersize + blkoffset == BLOCK_SIZE) + bawrite(bp); + else + bdwrite(bp); + + if (error || xfersize == 0) + break; + } + + if (error) { + if (ioflag & IO_UNIT) { + (void)minix_truncate(vp,osize,ioflag & IO_SYNC, cred, uio->uio_procp); + uio->uio_offset -= resid - uio->uio_resid; + uio->uio_resid = resid; + } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { + (void)minix_update(vp); + } + } + /* + * If we successfully wrote any data, and we are not the superuser + * we clear the setuid and setgid bits as a precaution against + * tampering. + */ + if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0) + ip->i_mode &= ~(ISUID | ISGID); + + if (xfersize > 0 && error == 0) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + (void)minix_update(vp); + } + + return error; +} + +static int +minix_create(struct vop_create_args *ap) +{ + struct componentname *cnp = ap->a_cnp; + int mode; + + if (strlen(cnp->cn_nameptr) > MINIX_NAME_MAX) + return ENAMETOOLONG; + + mode = MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode); + + return minix_makeinode(mode,ap->a_dvp, ap->a_vpp, cnp); +} +/* + * Just remove the directory entry and decrease the link count + * of the file, after a call to minix_namei(). + */ +static int +minix_remove(struct vop_remove_args *ap) +{ + struct vnode *vp = ap->a_vp; + struct vnode *dvp = ap->a_dvp; + struct minix_inode *ip = VTOMI(vp); + int error; + int prtrmv = 0; + + if ((error = minix_dirremove(dvp)) == 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + } + + if (error) + return error; + + if (prtrmv) { + vprint("remove: parent directory",dvp); + vprint("remove: source file",vp); + } + + return minix_update(dvp); +} +/* + * Add a link in a directory + */ +static int +minix_link(struct vop_link_args *ap) + /* + struct vop_link_args { + struct vnode *a_tdvp; + struct vnode *a_vp; + struct componentname *a_cnp; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct vnode *tdvp = ap->a_tdvp; + struct componentname *cnp = ap->a_cnp; + struct proc *p = cnp->cn_proc; + struct minix_inode *ip; + struct minix_direct newdir; + int error; + + if (tdvp->v_mount != vp->v_mount) + return EXDEV; + + if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) + return error; + + ip = VTOMI(vp); + if (ip->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto out; + } + ip->i_nlink++; + ip->i_flag |= IN_CHANGE; + if ((error = minix_update(vp)) == 0) { + minix_makedirentry(ip, cnp, &newdir); + if ((error = minix_direnter(tdvp, vp, &newdir, cnp)) != 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + (void)minix_update(vp); + } + } +out: + if (tdvp != vp) + VOP_UNLOCK(vp, 0, p); + + return error; +} +/* + * Mkdir system call. + */ +static int +minix_mkdir(struct vop_mkdir_args *ap) + /* + struct vop_mkdir_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + }; + */ +{ + struct vnode *dvp = ap->a_dvp; + struct vattr *vap = ap->a_vap; + struct componentname *cnp = ap->a_cnp; + struct minix_inode *dp = VTOMI(dvp); + struct vnode *tvp; + struct minix_inode *ip = NULL; + struct minix_dinode *dip; + struct minix_super_block *sp; + struct buf *bp; + struct minix_dirtemplate dirtemplate, *dtp; + struct minix_direct newdir; + int error, dmode; + struct minix_dirtemplate mastertemplate = { + 0, ".", + 0, ".." + }; + + if (dp->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto out; + } + dmode = vap->va_mode &0777; + dmode |= IFDIR; + + if ((error = minix_valloc(dvp, dmode, cnp->cn_cred, &tvp)) != 0) + goto out; + + ip = (struct minix_inode*)tvp->v_data; + sp = ip->i_su; + dip = &(ip->i_dino); + ip->i_dino.i_gid = dp->i_dino.i_gid; + ip->i_dino.i_uid = cnp->cn_cred->cr_uid; + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + ip->i_mode = dmode; + ip->i_dino.i_mode = dmode; + tvp->v_type = VDIR; + ip->i_nlink = 2; + /* + * Bump link count in parent directory to reflect work done below. + * Should be done before reference is created so cleanup is + * possible if we crash. + */ + dp->i_nlink++; + dp->i_flag |= IN_CHANGE; + if ((error = minix_update(tvp)) != 0) + goto bad; + /* + * Initialize directory with "." and ".." from static template. + */ + dtp = &mastertemplate; + dirtemplate = *dtp; + dirtemplate.dot_ino = ip->i_number; + dirtemplate.dotdot_ino = dp->i_number; + if ((error = minix_balloc(tvp, (u_daddr_t)0, &bp)) != 0) + goto bad; + dip->i_size = sizeof(dirtemplate); + ip->i_blocks = 1 << sp->s_zshift; + ip->i_flag |= IN_CHANGE | IN_UPDATE; + vnode_pager_setsize(tvp, (vm_ooffset_t)BLOCK_SIZE); + bcopy((caddr_t)&dirtemplate, (caddr_t)bp->b_data, sizeof(dirtemplate)); + + if ((error = minix_update(tvp)) != 0) { + (void)bwrite(bp); + goto bad; + } + /* + * Directory set up, now install its entry in the parent directory. + * + * If we are not doing soft dependencies, then we must write out the + * buffer containing the new directory body before entering the new + * name in the parent. If we are doing soft dependencies, then the + * buffer containing the new directory body will be passed to and + * released in the soft dependency code after the code has attached + * an appropriate ordering dependency to the buffer which ensures that + * the buffer is written before the new name is written in the parent. + */ + if ((error = bwrite(bp)) != 0) + goto bad; + + minix_makedirentry(ip, cnp, &newdir); + error = minix_direnter(dvp, tvp, &newdir, cnp); +bad: + if (error == 0) { + *ap->a_vpp = tvp; + } else { + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + /* + * No need to do an explicit VOP_TRUNCATE here, vrele will + * do this for us because we set the link count to 0. + */ + ip->i_nlink = 0; + ip->i_flag |= IN_CHANGE; + vput(tvp); + } +out: + return error; +} +/* + * Rmdir system call + */ +static int +minix_rmdir(struct vop_rmdir_args *ap) + /* + struct vop_rmdir_args { + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; + }; + */ +{ + struct vnode *vp = ap->a_vp; + struct vnode *dvp = ap->a_dvp; + struct componentname *cnp = ap->a_cnp; + struct proc *p = cnp->cn_proc; + struct minix_inode *ip, *dp; + int error, ioflag = IO_SYNC; + int prmdir = 0; + + ip = VTOMI(vp); + dp = VTOMI(dvp); + + /* + * Do not remove a directory that is in the process of being renamed. + * Verify the directory is empty (and valid). Rmdir ".." will not be + * valid since ".." will contain a reference to the current directory + * and thus be non-empty. Do not allow the removal of mounted on + * directories (this can happen when an NFS exported filesystem + * tries to remove a locally mounted on directory). + */ + error = 0; + if (ip->i_flag & IN_RENAME) { + error = EINVAL; + goto out; + } + if (ip->i_nlink > 2 || + !minix_dirempty(ip, dp->i_number, cnp->cn_cred)) { + error = ENOTEMPTY; + goto out; + } + if (vp->v_mountedhere != 0) { + error = EINVAL; + goto out; + } + /* + * Delete reference to directory before purging + * inode. If we crash in between, the directory + * will be reattached to lost+found, + */ + if ((error = minix_dirremove(dvp)) != 0) + goto out; + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + cache_purge(dvp); + VOP_UNLOCK(dvp, 0, p); + (void)minix_update(dvp); + /* + * Truncate inode. The only stuff left in the directory is "." and + * "..". The "." reference is inconsequential since we are quashing + * it. + */ + ip->i_nlink -= 2; + ip->i_flag |= IN_CHANGE; + error = minix_truncate(vp, (off_t)0, ioflag, cnp->cn_cred, p); + cache_purge(vp); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); +out: + if (prmdir) { + vprint("rmdir: parent directory",dvp); + vprint("rmdir: source directory",vp); + } + return error; +} +/* + * mknod system call + */ +static int +minix_mknod(struct vop_mknod_args *ap) + /* + struct vop_mknod_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + }; + */ +{ + struct vnode **vpp = ap->a_vpp; + struct vattr *vap = ap->a_vap; + struct minix_inode *ip; + ino_t ino; + int error; + + error = minix_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), + ap->a_dvp, vpp, ap->a_cnp); + if (error) + return error; + ip = VTOMI(*vpp); + ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; + if (vap->va_rdev != VNOVAL) + ip->i_rdev = vap->va_rdev; + /* + * Remove inode, then reload it through VFS_VGET so it is + * checked to see if it is an alias of an existing entry in + * the inode cache. + */ + vput(*vpp); + (*vpp)->v_type = VNON; + ino = ip->i_number; /* Save this before vgone() invalidates ip. */ + vgone(*vpp); + if ((error = VFS_VGET(ap->a_dvp->v_mount, ino, vpp)) != 0) { + *vpp = NULL; + return error; + } + return minix_update(*vpp); +} +/* + * Rename system call. Follows FreeBSD's ufs. + * rename("foo", "bar"); + * is essentially + * unlink("bar"); + * link("foo", "bar"); + * unlink("foo"); + * but ``atomically''. Can't do full commit without saving state in the + * inode on disk which isn't feasible at this time. Best we can do is + * always guarantee the target exists. + * + * Basic algorithm is: + * + * 1) Bump link count on source while we're linking it to the + * target. This also ensures the inode won't be deleted out + * from underneath us while we work (it may be truncated by + * a concurrent `trunc' or `open' for creation). + * 2) Link source to destination. If destination already exists, + * delete it first. + * 3) Unlink source reference to inode if still around. If a + * directory was moved and the parent of the destination + * is different from the source, patch the ".." entry in the + * directory. + */ +static int +minix_rename(struct vop_rename_args *ap) + /* + struct vop_rename_args { + struct vnode *ap_fdvp; + struct vnode *ap_fvp; + struct componentname *ap_fcnp; + struct vnode *ap_tdvp; + struct vnode *ap_tvp; + struct componentname *ap_tcnp; + }; + */ +{ + /* + * fdvp is the old parent directory + * fvp is the file to be renamed + * fcnp is the path info about the current file: fvp + * tdvp is the new parent directory + * tvp is the new 'target' file name (if it exists) + * tcnp is the path info about the file's new name + */ + struct vnode *tvp = ap->a_tvp; + register struct vnode *tdvp = ap->a_tdvp; + struct vnode *fvp = ap->a_fvp; + struct vnode *fdvp = ap->a_fdvp; + struct componentname *tcnp = ap->a_tcnp; + struct componentname *fcnp = ap->a_fcnp; + struct proc *p = fcnp->cn_proc; + struct minix_inode *ip, *xp, *dp; + struct minix_direct newdir; + int doingdirectory = 0, oldparent = 0, newparent = 0; + int entry, error = 0, ioflag = IO_SYNC; + + /* + * Check for cross-device rename. + */ + if ((fvp->v_mount != tdvp->v_mount) || + (tvp && (fvp->v_mount != tvp->v_mount))) { + error = EXDEV; + abortit: + if (tdvp == tvp) + vrele(tdvp); + else + vput(tdvp); + if (tvp) + vput(tvp); + vrele(fdvp); + vrele(fvp); + return error; + } + /* + * Check if just deleting a link name. + */ + if (fvp == tvp) { + if (fvp->v_type == VDIR) { + error = ENOENT; + goto abortit; + } + + /* + * Release destination. + */ + vput(tdvp); + vput(tvp); + /* + * Delete source. Pretty bizarre stuff. + */ + vrele(fdvp); + vrele(fvp); + fcnp->cn_flags &= ~MODMASK; + fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; + fcnp->cn_nameiop = DELETE; + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); + if (error == 0) + vrele(fdvp); + if (fvp == NULL) + return ENOENT; + error = VOP_REMOVE(fdvp, fvp, fcnp); + if (fdvp == fvp) + vrele(fdvp); + else + vput(fdvp); + if (fvp != NULL) + vput(fvp); + return error; + } + + if ((error = vn_lock(fvp, LK_EXCLUSIVE, p)) != 0) + goto abortit; + + dp = VTOMI(fdvp); /* From directory */ + ip = VTOMI(fvp); /* From inode */ + + if (ip->i_nlink >= MINIX_LINK_MAX) { + VOP_UNLOCK(fvp, 0, p); + error = EMLINK; + goto abortit; + } + + if ((ip->i_mode & IFMT) == IFDIR) { + /* + * Avoid ".", "..", and aliases of "." for obvious reasons. + */ + if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') + || dp->i_number == ip->i_number + || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { + VOP_UNLOCK(fvp, 0, p); + error = EINVAL; + goto abortit; + } + ip->i_flag |= IN_RENAME; + oldparent = dp->i_number; + doingdirectory = 1; + } + vrele(fdvp); + + /* + * When the target exists, both the directory + * and target vnodes are returned locked. + */ + + dp = VTOMI(tdvp); /* dp is now the target directory */ + xp = NULL; + if (tvp) + xp = VTOMI(tvp); /* xp is now the target file name */ + + /* + * Bump link count on fvp while we are moving stuff around. If we + * crash before completing the work, the link count may be wrong + * but correctable. + */ + ip->i_nlink++; + ip->i_flag |= IN_CHANGE; + if ((error = minix_update(fvp)) != 0) { + VOP_UNLOCK(fvp, 0, p); + goto bad; + } + + /* + * If ".." must be changed (ie the directory gets a new + * parent) then the source directory must not be in the + * directory hierarchy above the target, as this would + * orphan everything below the source directory. Also + * the user must have write permission in the source so + * as to be able to change "..". + */ + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); + VOP_UNLOCK(fvp, 0, p); + if (oldparent != dp->i_number) + newparent = dp->i_number; + if (doingdirectory && newparent) { + if (error) /* write access check above */ + goto bad; + if (xp != NULL) + vput(tvp); + if ((error = minix_checkpath(ip, dp, tcnp->cn_cred)) != 0) + goto out; + VREF(tdvp); + error = relookup(tdvp, &tvp, tcnp); + if (error) + goto out; + vrele(tdvp); + dp = VTOMI(tdvp); + xp = NULL; + if (tvp) + xp = VTOMI(tvp); + } + +/* + * If the target doesn't exist, link the target to the source and + * unlink the source. Otherwise, rewrite the target directory to + * reference the source and remove the original entry. + */ + if (xp == NULL) { + if (dp->i_dev != ip->i_dev) + panic("minix_rename: EXDEV"); + /* + * Account for ".." in new directory. + * When source and destination have the same + * parent we don't fool with the link count. + */ + if (doingdirectory && newparent) { + if ((nlink_t)dp->i_nlink >= MINIX_LINK_MAX) { + error = EMLINK; + goto bad; + } + dp->i_nlink++; + dp->i_flag |= IN_CHANGE; + if ((error = minix_update(tdvp)) != 0) + goto bad; + } + minix_makedirentry(ip, tcnp, &newdir); + error = minix_direnter(tdvp, NULL, &newdir, tcnp); + + if (error) { + if (doingdirectory && newparent) { + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + (void)minix_update(tdvp); + } + goto bad; + } + vput(tdvp); + } else { + + if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev) + panic("minix_rename: EXDEV"); + /* + * Target must be empty if a directory and have no links + * to it. Also, ensure source and target are compatible + * (both directories, or both not directories). + */ + if ((xp->i_mode&IFMT) == IFDIR) { + if ((xp->i_nlink > 2) || + !minix_dirempty(xp, dp->i_number, tcnp->cn_cred)) { + error = ENOTEMPTY; + goto bad; + } + if (!doingdirectory) { + error = ENOTDIR; + goto bad; + } + /* + * Update name cache since directory is going away. + */ + cache_purge(tdvp); + + } else if (doingdirectory) { + error = EISDIR; + goto bad; + } + + /* + * Change name tcnp in tdvp to point at fvp. + */ + + if ((entry = dp->i_entry) < 2) { + printf("rename: i_entry < 2\n"); + error = EIO; + goto bad; + } + + if ((error = minix_dirrewrite(dp, xp, ip->i_number, entry)) != 0) + goto bad; + + /* + * If the target directory is in same directory as the source + * directory, decrement the link count on the parent of the + * target directory. This accounts for the fact that a + * directory links back to its parent with .. + */ + + if (doingdirectory) { + if (!newparent) { + /* Decrement the link count of tdvp */ + dp->i_nlink--; + dp->i_flag |= IN_CHANGE; + } + xp->i_nlink--; + xp->i_flag |= IN_CHANGE; + if (--xp->i_nlink != 0) + panic("minix_rename: linked directory"); + if ((error = minix_truncate(tvp, (off_t)0, ioflag, + tcnp->cn_cred, tcnp->cn_proc)) != 0) + goto bad; + } + + vput(tdvp); + vput(tvp); + xp = NULL; + } +/* + * Unlink the source. If a directory was moved to a new parent, + * update its ".." entry. Gobs of ugly UFS code omitted here. + */ + fcnp->cn_flags &= ~MODMASK; + fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); /* Relookup gets a new vnode/inode */ + if (error == 0) + vrele(fdvp); + if (fvp != NULL) { + xp = VTOMI(fvp); + dp = VTOMI(fdvp); + } else { + /* + * From name has disappeared. + */ + if (doingdirectory) + panic("minix_rename: lost dir entry"); + vrele(ap->a_fvp); + return (0); + } +/* + * Ensure that the directory entry still exists and has not + * changed while the new name has been entered. If the source is + * a file then the entry may have been unlinked or renamed. In + * either case there is no further work to be done. If the source + * is a directory then it cannot have been rmdir'ed; the IN_RENAME + * flag ensures that it cannot be moved by another rename or removed + * by a rmdir. + */ + if (xp->i_number != ip->i_number) { /* Need to compare inode numbers here */ + if (doingdirectory) + panic("minix_rename: lost dir entry"); + } else { + /* + * If the source is a directory with a + * new parent, the link count of the old + * parent directory must be decremented + * and ".." set to point to the new parent. + */ + if (doingdirectory && newparent) { + entry = 1; /* entry #1 is '..' in a Minix directory */ + minix_dirrewrite(xp, dp, newparent, entry); + cache_purge(fdvp); + } + if((error = minix_dirremove(fdvp)) != 0) + printf("minix_dirremove: error = %d\n",error); + if (!error) { + cache_purge(fvp); + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + ip->i_flag &= ~IN_RENAME; + (void)minix_update(fvp); + dp->i_flag |= IN_CHANGE | IN_UPDATE; + (void)minix_update(fdvp); + } + } + if (dp) + vput(dp->i_vnode); + if (xp) + vput(xp->i_vnode); + vrele(ap->a_fvp); + return error; + +bad: + if (xp) + vput(xp->i_vnode); + if (dp) + vput(dp->i_vnode); +out: + if (doingdirectory) + ip->i_flag &= ~IN_RENAME; + if (vn_lock(fvp, LK_EXCLUSIVE, p) == 0) { + ip->i_nlink--; + ip->i_flag |= IN_CHANGE; + ip->i_flag &= ~IN_RENAME; + (void)minix_update(fvp); + vput(fvp); + } else + vrele(fvp); + + return error; +} +/* + * Return POSIX pathconf information applicable to minix filesystems. + */ +static int +minix_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + int *a_retval; + } */ *ap; +{ + switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = MINIX_LINK_MAX; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = MINIX_NAME_MAX; + return (0); + case _PC_PATH_MAX: + *ap->a_retval = MINIX_PATH_MAX; + return (0); + case _PC_PIPE_BUF: + *ap->a_retval = MINIX_PIPE_BUF; + return (0); + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = 1; + return (0); + case _PC_NO_TRUNC: + *ap->a_retval = 1; + return (0); + default: + return (EINVAL); + } + /* NOTREACHED */ +} +/* The fifo calls below follow ufs's fifofs */ +/* + * Update the times on the inode for the fifo then close + */ +static int +minixfifo_close(struct vop_close_args *ap) +{ + struct vnode *vp = ap->a_vp; + + simple_lock(&vp->v_interlock); + if (vp->v_usecount > 1) + minix_itimes(vp); + simple_unlock(&vp->v_interlock); + return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); +} +/* + * Read wrapper for fifos. + */ +static int +minixfifo_read(struct vop_read_args *ap) +{ + int error, resid; + struct uio *uio = ap->a_uio; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + + resid = uio->uio_resid; + error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap); + if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && + ip != NULL && (uio->uio_resid != resid || + (error == 0 && resid != 0))) + ip->i_flag |= IN_ACCESS; + return error; +} +/* + * Write wrapper for fifos. + */ +static int +minixfifo_write(struct vop_write_args *ap) +{ + int error, resid; + struct uio *uio = ap->a_uio; + struct vnode *vp = ap->a_vp; + struct minix_inode *ip = VTOMI(vp); + + resid = uio->uio_resid; + error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap); + if (ip != NULL && (uio->uio_resid != resid ||(error == 0 && resid != 0))) + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return error; +} +static int +minix_getpages(struct vop_getpages_args *ap) +{ + return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_reqpage); +} +static int +minix_putpages(struct vop_putpages_args *ap) +{ + return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_sync, ap->a_rtvals); +} diff -ruN sys.orig/modules/Makefile sys/modules/Makefile --- sys.orig/modules/Makefile Sat May 4 01:23:52 2002 +++ sys/modules/Makefile Fri Feb 28 13:46:46 2003 @@ -102,6 +102,7 @@ gnufpu \ ibcs2 \ linprocfs \ + minixfs \ mly \ ncv \ nsp \ diff -ruN sys.orig/modules/minixfs/Makefile sys/modules/minixfs/Makefile --- sys.orig/modules/minixfs/Makefile Wed Dec 31 16:00:00 1969 +++ sys/modules/minixfs/Makefile Fri Feb 28 13:46:44 2003 @@ -0,0 +1,11 @@ +# $FreeBSD: src/sys/modules/minixfs/Makefile,v 1.10 021105 Ed Exp $ + +.PATH: ${.CURDIR}/../../fs/minixfs +KMOD= minixfs +SRCS= vnode_if.h \ + minix_subr.c minix_vfsops.c minix_vnops.c minix_lookup.c \ + minix_bio.c minix_inode.c minix_ufs.c minix_locks.c \ + minix_ihash.c minix_alock.s +NOMAN= + +.include diff -ruN sys.orig/sys/vnode.h sys/sys/vnode.h --- sys.orig/sys/vnode.h Mon Dec 24 17:44:44 2001 +++ sys/sys/vnode.h Fri Feb 28 13:46:55 2003 @@ -65,7 +65,7 @@ VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_SMBFS + VT_HPFS, VT_NWFS, VT_SMBFS, VT_MINIXFS }; /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message From owner-freebsd-bugs Sat Mar 1 6: 0:42 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5916D37B401 for ; Sat, 1 Mar 2003 06:00:30 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E650743F93 for ; Sat, 1 Mar 2003 06:00:28 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h21E0SNS099414 for ; Sat, 1 Mar 2003 06:00:28 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h21E0SnB099413; Sat, 1 Mar 2003 06:00:28 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F75137B401 for ; Sat, 1 Mar 2003 05:55:01 -0800 (PST) Received: from grosbein.pp.ru (www2.svzserv.kemerovo.su [213.184.65.86]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A01D43FDD for ; Sat, 1 Mar 2003 05:54:26 -0800 (PST) (envelope-from eugen@grosbein.pp.ru) Received: from grosbein.pp.ru (smmsp@localhost [127.0.0.1]) by grosbein.pp.ru (8.12.7/8.12.7) with ESMTP id h21DsJpU000941 for ; Sat, 1 Mar 2003 20:54:19 +0700 (KRAT) (envelope-from eugen@grosbein.pp.ru) Received: (from eugen@localhost) by grosbein.pp.ru (8.12.7/8.12.7/Submit) id h21DlMQh000456; Sat, 1 Mar 2003 20:47:22 +0700 (KRAT) Message-Id: <200303011347.h21DlMQh000456@grosbein.pp.ru> Date: Sat, 1 Mar 2003 20:47:22 +0700 (KRAT) From: Eugene Grosbein Reply-To: Eugene Grosbein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/48808: uhid(4)-related repeatable kernel panic in 4.8-PRERELEASE Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 48808 >Category: kern >Synopsis: uhid(4)-related repeatable kernel panic in 4.8-PRERELEASE >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 01 06:00:28 PST 2003 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: Svyaz Service JSC >Environment: System: FreeBSD grosbein.pp.ru 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #0: Sat Mar 1 20:19:18 KRAT 2003 eu@grosbein.pp.ru:/usr/local/obj/usr/local/src/sys/DADV i386 Sources cvsup'd 23 Feb 2003. >Description: 4.8-PRERELEASE panices after open/detach/attach/open of APC BackUPS CS BK500EI USB (uhid0). Here is debug trace: Script started on Sat Mar 1 20:34:55 2003 GNU gdb 4.18 (FreeBSD) Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/local/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in elfstab_build_psymtabs Deprecated bfd_read called at /usr/local/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf IdlePTD at phsyical address 0x003b7000 initial pcb at physical address 0x0030e860 panicstr: page fault panic messages: --- Fatal trap 12: page fault while in kernel mode fault virtual address = 0x64696875 fault code = supervisor read, page not present instruction pointer = 0x8:0xc015b087 stack pointer = 0x10:0xcf5c3cc4 frame pointer = 0x10:0xcf5c3ce0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 16 (cat) interrupt mask = net tty bio cam trap number = 12 panic: page fault syncing disks... done Uptime: 47s dumping to dev #ad/0x20011, offset 128 dump ata1: resetting devices .. ad2: invalidating queued requests done 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 6! 3 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 --- #0 dumpsys () at /usr/local/src/sys/kern/kern_shutdown.c:487 487 if (dumping++) { (kgdb) where #0 dumpsys () at /usr/local/src/sys/kern/kern_shutdown.c:487 #1 0xc015f898 in boot (howto=256) at /usr/local/src/sys/kern/kern_shutdown.c:316 #2 0xc015fce5 in panic (fmt=0xc02bec4c "%s") at /usr/local/src/sys/kern/kern_shutdown.c:595 #3 0xc026d008 in trap_fatal (frame=0xcf5c3c84, eva=1684629621) at /usr/local/src/sys/i386/i386/trap.c:974 #4 0xc026cc9d in trap_pfault (frame=0xcf5c3c84, usermode=0, eva=1684629621) at /usr/local/src/sys/i386/i386/trap.c:867 #5 0xc026c82f in trap (frame={tf_fs = -816054256, tf_es = -1071579120, tf_ds = -1052901360, tf_edi = -1070723776, tf_esi = -1070538352, tf_ebp = -816038688, tf_isp = -816038736, tf_ebx = -1070723776, tf_edx = 4, tf_ecx = 4, tf_eax = 1684629621, tf_trapno = 12, tf_err = 0, tf_eip = -1072320377, tf_cs = 8, tf_eflags = 66050, tf_esp = -1051861572, tf_ss = 12}) at /usr/local/src/sys/i386/i386/trap.c:466 #6 0xc015b087 in malloc (size=12, type=0xc02e0d40, flags=1) at /usr/local/src/sys/kern/kern_malloc.c:243 #7 0xc02107d3 in uhci_allocm (bus=0xc13dd000, dma=0xc14dddbc, size=12) at /usr/local/src/sys/dev/usb/uhci.c:497 #8 0xc0214bc6 in usbd_transfer (xfer=0xc14ddd80) at /usr/local/src/sys/dev/usb/usbdi.c:259 #9 0xc0214ad3 in usbd_open_pipe_intr (iface=0xc0c1c360, address=129, flags=4 '\004', pipe=0xc13eca8c, priv=0xc13eca80, buffer=0xc13e66a0, ---Type to continue, or q to quit--- len=12, cb=0xc0219d18 , ival=-1) at /usr/local/src/sys/dev/usb/usbdi.c:195 #10 0xc0219e60 in uhidopen (dev=0xc13eca00, flag=1, mode=8192, p=0xcddd82a0) at /usr/local/src/sys/dev/usb/uhid.c:408 #11 0xc019987a in spec_open (ap=0xcf5c3e08) at /usr/local/src/sys/miscfs/specfs/spec_vnops.c:193 #12 0xc0199775 in spec_vnoperate (ap=0xcf5c3e08) at /usr/local/src/sys/miscfs/specfs/spec_vnops.c:119 #13 0xc01ff085 in ufs_vnoperatespec (ap=0xcf5c3e08) at /usr/local/src/sys/ufs/ufs/ufs_vnops.c:2394 #14 0xc01955c4 in vn_open (ndp=0xcf5c3ed4, fmode=1, cmode=0) at vnode_if.h:189 #15 0xc01913f8 in open (p=0xcddd82a0, uap=0xcf5c3f80) at /usr/local/src/sys/kern/vfs_syscalls.c:1028 #16 0xc026d279 in syscall2 (frame={tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 134564965, tf_esi = -1077936691, tf_ebp = -1077936992, tf_isp = -816037932, tf_ebx = -1077936692, tf_edx = 0, tf_ecx = 1, tf_eax = 5, tf_trapno = 12, tf_err = 2, tf_eip = 134532092, tf_cs = 31, tf_eflags = 659, tf_esp = -1077937036, tf_ss = 47}) at /usr/local/src/sys/i386/i386/trap.c:1175 #17 0xc0260295 in Xint0x80_syscall () #18 0x804833b in ?? () #19 0x804813e in ?? () (kgdb) frame 6 #6 0xc015b087 in malloc (size=12, type=0xc02e0d40, flags=1) at /usr/local/src/sys/kern/kern_malloc.c:243 243 va = kbp->kb_next; (kgdb) p va $1 = 0x64696875
(kgdb) quit Script done on Sat Mar 1 20:35:09 2003 Here is my kernel config: #for strings -n 3 /kernel | grep ^___ | sed -e 's/^___//' > MYKERNEL options INCLUDE_CONFIG_FILE machine i386 #cpu I386_CPU #cpu I486_CPU #cpu I586_CPU cpu I686_CPU options CPU_ENABLE_SSE #enables SSE/MMX2 instructions support. ident DADV maxusers 128 makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols #options MATH_EMULATE #Support for x87 emulation options CLK_CALIBRATION_LOOP options "CLK_USE_I8254_CALIBRATION" options CLK_USE_TSC_CALIBRATION options INET #InterNETworking #options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options FFS_ROOT #FFS usable as root device [keep this!] #options MFS #Memory Filesystem #options MD_ROOT #MD is a potential root device #options NFS #Network Filesystem #options NFS_ROOT #NFS usable as root device, NFS required options MSDOSFS #MSDOS Filesystem #options CD9660 #ISO 9660 Filesystem #options CD9660_ROOT #CD-ROM usable as root, CD9660 required options PROCFS #Process filesystem #options EXT2FS #Linux ext2 filesystem options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI options UCONSOLE #Allow users to grab the console options USERCONFIG #boot -c editor options VISUAL_USERCONFIG #visual boot -c editor options KTRACE #ktrace(1) support options CPU_SUSP_HLT #options "NO_F00F_HACK" options USER_LDT options PPP_BSDCOMP options PPP_DEFLATE options PPP_FILTER options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options SHMALL=4097 options SHMMAXPGS=4097 options SHMMAX=(SHMMAXPGS*PAGE_SIZE+1) options SEMMAP=255 options SEMMNI=235 options SEMMNS=255 options SEMMNU=235 options SEMMSL=255 options SEMOPM=201 options SEMUME=201 options P1003_1B #Posix P1003_1B real-time extensions options _KPOSIX_PRIORITY_SCHEDULING options _KPOSIX_VERSION=199309L options ICMP_BANDLIM #Rate limit bad replies #options FDESC options NSWAPDEV=4 device isa device eisa device pci options AUTO_EOI_1 # Floppy drives device fdc0 at isa? port IO_FD1 irq 6 drq 2 device fd0 at fdc0 drive 0 #device fd1 at fdc0 drive 1 # ATA and ATAPI devices #device ata0 at isa? port IO_WD1 irq 14 flags 0xb0ffb0ff #device ata1 at isa? port IO_WD2 irq 15 flags 0xb0ffb0ff device ata device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives #device atapifd # ATAPI floppy drives #device atapist # ATAPI tape drives options ATA_STATIC_ID #Static device numbering # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc0 at isa? port IO_KBD device atkbd0 at atkbdc? irq 1 # Options for atkbd: options ATKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions ATKBD_DFLT_KEYMAP="ru.koi8-r.pdwn" device psm0 at atkbdc? irq 12 device vga0 at isa? options VESA options VGA_WIDTH90 # splash screen/screen saver pseudo-device splash # syscons is the default console driver, resembling an SCO console device sc0 at isa? options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp866 options MAXCONS=24 options SC_HISTORY_SIZE=1000 options SC_MOUSE_CHAR=0x03 #options SC_TWOBUTTON_MOUSE options SC_PIXEL_MODE # Floating point support - do not disable. device npx0 at nexus? port IO_NPX irq 13 # Power management support (see LINT for more options) #device apm0 at nexus? flags 0x31 # Advanced Power Management device apm0 at nexus? # Advanced Power Management # Serial (COM) ports device sio0 at isa? port IO_COM1 flags 0x10 irq 4 device sio1 at isa? port IO_COM2 irq 3 device miibus device fxp # Parallel port device ppc0 at isa? irq 7 device ppbus # Parallel port bus (required) device lpt # Printer #device plip # TCP/IP over parallel device ppi # Parallel port interface device #device joy0 at isa? port IO_GAME # Pseudo devices - the number indicates how many units to allocated. pseudo-device loop # Network loopback pseudo-device ether # Ethernet support pseudo-device sl 2 # Kernel SLIP pseudo-device ppp 2 # Kernel PPP pseudo-device tun # Packet tunnel. pseudo-device pty 16 # Pseudo-ttys (telnet etc) #pseudo-device md # Memory "disks" pseudo-device gif 4 # IPv6 and IPv4 tunneling pseudo-device faith 1 # IPv6-to-IPv4 relaying (translation) pseudo-device snp #pseudo-device vn pseudo-device gzip # Exec gzipped a.out's pseudo-device speaker # The `bpf' pseudo-device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! pseudo-device bpf #Berkeley packet filter options MSGBUF_SIZE=40960 device pcm #options QUOTA options IPFIREWALL options IPFIREWALL_VERBOSE #options "IPFIREWALL_VERBOSE_LIMIT=100" options IPDIVERT options IPSTEALTH options DUMMYNET options SOFTUPDATES #device smbus0 #device iicbus0 #device iicbb0 #device intpm0 #device smb0 at smbus? device smbus #device iicbus #device iicbb device intpm #device alpm #device ichsmb device smb #device ic #device iic #device iicsmb options DDB options DDB_UNATTENDED #options LIBMCHAIN #options LIBICONV #options NETSMB #options NETSMBCRYPTO options RANDOM_IP_ID #options SMBFS options UFS_DIRHASH options PQ_CACHESIZE=128 # color for 128k/16k cache options SHOW_BUSYBUFS device uhci #device ohci device usb device uscanner device ugen device uhid device ucom device tap #options SHUTDOWN_BEEP options IPSEC #IP security options IPSEC_ESP #IP security (crypto; define w/ IPSEC) Here is my dmesg output: Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.8-PRERELEASE #0: Sat Mar 1 20:19:18 KRAT 2003 eu@grosbein.pp.ru:/usr/local/obj/usr/local/src/sys/DADV Timecounter "i8254" frequency 1193164 Hz CPU: Intel Celeron (902.03-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x68a Stepping = 10 Features=0x383f9ff real memory = 335478784 (327616K bytes) config> flags atkbd 0x0 config> quit avail memory = 322293760 (314740K bytes) Preloaded elf kernel "kernel" at 0xc0398000. Preloaded userconfig_script "/boot/kernel.conf" at 0xc039809c. VESA: v2.0, 4096k memory, flags:0x1, mode table:0xc00c0e38 (c0000e38) VESA: S3 Incorporated Trio3D. Pentium Pro MTRR support enabled Using $PIR table, 8 entries at 0xc00fdef0 apm0: on motherboard apm0: found APM BIOS v1.2, connected at v1.2 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 pcib1: at device 1.0 on pci0 pci1: on pcib1 pci1: at 0.0 isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0xf000-0xf00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0: port 0xe000-0xe01f irq 11 at device 7.2 on pci0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered uscanner0: Hewlett-Packard HP ScanJet 2200C, rev 1.10/1.00, addr 2 uhid0: American Power Conversion Back-UPS 500 FW: 6.5.I USB FW: c1 , rev 1.10/1.00, addr 3, iclass 3/0 intpm0: port 0x5000-0x500f irq 9 at device 7.3 on pci0 intpm0: I/O mapped 5000 intpm0: intr IRQ 9 enabled revision 0 smbus0: on intsmb0 smb0: on smbus0 intpm0: PM I/O mapped 4000 fxp0: port 0xe400-0xe43f mem 0xe5000000-0xe50fffff,0xe5100000-0xe5100fff irq 10 at device 15.0 on pci0 fxp0: Ethernet address 00:90:27:a7:5c:72 inphy0: on miibus0 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto orm0: