From owner-cvs-all Fri Feb 2 21:38:52 2001 Delivered-To: cvs-all@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id EDD4637B491 for ; Fri, 2 Feb 2001 21:38:32 -0800 (PST) Received: by bazooka.unixfreak.org (Postfix, from userid 1000) id 7DE793E02; Fri, 2 Feb 2001 21:38:32 -0800 (PST) Received: from unixfreak.org (localhost [127.0.0.1]) by bazooka.unixfreak.org (Postfix) with ESMTP id 76CE83C10C; Fri, 2 Feb 2001 21:38:32 -0800 (PST) To: Mike Meyer Cc: cvs-all@freebsd.org Subject: Re: mdconfig config file (was: cvs commit: src/sys/i386/conf GENERI C) In-Reply-To: Message from Mike Meyer of "Fri, 02 Feb 2001 22:49:22 CST." <14971.36306.550056.3968@guru.mired.org> Date: Fri, 02 Feb 2001 21:38:27 -0800 From: Dima Dorfman Message-Id: <20010203053832.7DE793E02@bazooka.unixfreak.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Dima Dorfman types: > > > (this whole thing is predicated on someone writing a mount_md wrapper > > > for MD that mimics the options mount_mfs accepts, for compatibility). > > > > I'll do it. Would it be safe to assume that it's acceptable to write > > a C program to parse the arguments, build command lines to > > appropriately invoke disklabel, newfs, maybe tunefs, and mount, then > > call system(3) to execute them? > > If you're going to use system on them all, why not just use Perl or a > shell script and getopts? No reason. I prefer C because I feel limited by Perl. On more than one occasion I find myself having to use multiple regexps for something I could do in one line if I had pointers. That's not to say Perl is bad; it has its uses, but, IMHO (and not many others', probably), this isn't one of them. > The only thing that's really painful in this process (at least now > that the hard work has been done) newfs. This suggests that, instead > of a new program, making newfs do duty as mount_md - similar to the > way it does mount_mfs now - might be the way to do it. Personally, I don't like how mount_mfs is implemented now. Perhaps there was good reason for doing it this way, but I don't like it. It isn't even a separate subroutine within newfs, it is just kind of stuck in the middle. In fact, I think all of newfs(8) is ugly; anything that has a 500-line subroutine is. Then again, many may not agree. > That leaves out the tunefs functionality, which begs the question - > why doesn't newfs have (at least some of) tunefs functionality now? I, It does. Most of what tunefs can do you can do at newfs time. I think tunefs(8) was originally created so certain parameters could be changed without recreating a filesystem. > for one, would like to be able to enable soft updates on a file system > when it's created. There's a good idea! I would too! So, to bring us one step closer to what we'd like to be able to do, attached is a patch which adds a -g option to newfs which will enable softupdates (I'd use -n for consistency with tunefs, but it's taken). I'd appreciate if someone would test it, but tred lightly; there's no guarnatee that it doesn't do something weird like disable the "write to permanent media" feature or something (I'm saying this because I set the default 'flags' to 0, and I don't know if that's what it should be). Regards Dima Dorfman dima@unixfreak.org Index: mkfs.c =================================================================== RCS file: /st/src/FreeBSD/src/sbin/newfs/mkfs.c,v retrieving revision 1.33 diff -u -r1.33 mkfs.c --- mkfs.c 2001/01/15 18:30:34 1.33 +++ mkfs.c 2001/02/03 05:30:51 @@ -111,6 +111,7 @@ extern int cpgflg; /* cylinders/cylinder group flag was given */ extern int minfree; /* free space threshold */ extern int opt; /* optimization preference (space or time) */ +extern int flags; /* filesystem flags */ extern int density; /* number of bytes per inode */ extern int maxcontig; /* max contiguous blocks to allocate */ extern int rotdelay; /* rotational delay between blocks */ @@ -652,6 +653,7 @@ sblock.fs_maxbpg = maxbpg; sblock.fs_rps = rpm / 60; sblock.fs_optim = opt; + sblock.fs_flags = flags; sblock.fs_cgrotor = 0; sblock.fs_cstotal.cs_ndir = 0; sblock.fs_cstotal.cs_nbfree = 0; Index: newfs.c =================================================================== RCS file: /st/src/FreeBSD/src/sbin/newfs/newfs.c,v retrieving revision 1.31 diff -u -r1.31 newfs.c --- newfs.c 2000/05/31 01:00:51 1.31 +++ newfs.c 2001/02/03 05:30:51 @@ -192,6 +192,7 @@ int cpgflg; /* cylinders/cylinder group flag was given */ int minfree = MINFREE; /* free space threshold */ int opt = DEFAULTOPT; /* optimization preference (space or time) */ +int flags = 0; /* filesystem flags */ int density; /* number of bytes per inode */ int maxcontig = 0; /* max contiguous blocks to allocate */ int rotdelay = ROTDELAY; /* rotational delay between blocks */ @@ -249,7 +250,7 @@ opstring = mfs ? "NF:T:a:b:c:d:e:f:i:m:o:s:" : - "NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:"; + "NOS:T:a:b:c:d:e:f:gi:k:l:m:n:o:p:r:s:t:u:vx:"; while ((ch = getopt(argc, argv, opstring)) != -1) switch (ch) { case 'N': @@ -296,6 +297,9 @@ case 'f': if ((fsize = atoi(optarg)) <= 0) fatal("%s: bad fragment size", optarg); + break; + case 'g': + flags |= FS_DOSOFTDEP; break; case 'i': if ((density = atoi(optarg)) <= 0) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message