summaryrefslogtreecommitdiff
path: root/ufs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'ufs-utils')
-rw-r--r--ufs-utils/ChangeLog127
-rw-r--r--ufs-utils/Makefile3
-rw-r--r--ufs-utils/dlabel.c12
-rw-r--r--ufs-utils/mkfs.c50
-rw-r--r--ufs-utils/stati.c3
5 files changed, 39 insertions, 156 deletions
diff --git a/ufs-utils/ChangeLog b/ufs-utils/ChangeLog
deleted file mode 100644
index 656a25ec..00000000
--- a/ufs-utils/ChangeLog
+++ /dev/null
@@ -1,127 +0,0 @@
-Thu Apr 10 13:54:31 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * dlabel.c: Don't include <mach/sa/sys/ioctl.h>.
- (_IOR, _IOC, IOC_OUT, IOCPARM_MASK): New macros.
-
-Wed Feb 19 23:10:54 1997 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (argp_program_version): Make const.
-
-Thu Sep 5 11:44:38 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * mkfs.c: Include <version.h>.
- (argp_program_version): Define with STANDARD_HURD_VERSION.
-
-Mon Aug 19 15:18:30 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (doc): Supply a useful value.
-
-Tue Jul 23 19:34:58 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (fsinit): `struct timespec' now uses a field prefix of `tv_'.
- * stati.c (timespec_rep): Likewise.
-
-Fri Jun 21 02:12:16 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * dlabel.c (fd_get_device): Supply new args to store_create.
-
-Sat May 11 01:20:18 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (parse_opt): Use ARGP_ERR_UNKNOWN instead of EINVAL.
-
-Fri May 10 15:50:38 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * dlabel.c (fd_get_device): Update to use libstore.
- <hurd/store.h>: New include.
- * Makefile (mkfs.ufs): Depend on ../libstore/libstore.a.
-
-Tue Apr 30 10:06:21 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * Makefile (include ../Makeconf): BEFORE dependencies.
- (all): Delete target.
- ($(targets)): Each target depends on its associated .o.
-
-Wed Apr 3 16:31:13 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (main): In `Can't get disklabel' error message, specify
- which flag the user can use to supply the needed information.
- (mkfs): Fiddle with info message.
-
-Sun Mar 31 14:34:28 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * stati.c (mode_rep): Prefix octal number with `0'.
-
-Fri Mar 29 11:56:52 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * stati.c (main): Print mode & {in,}direct blocks too.
- (mode_rep): New function.
- (timespec_rep): P shouldn't be static.
-
- * mkfs.c (main): Argp interface changes.
-
-Wed Mar 13 18:30:55 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * mkfs.c (options, args_doc, doc): New variables for option parsing.
- (struct amark): New type.
- (amarks_add, amarks_contains): New functions.
- (default_disklabel): New variable.
- (main): Most arguments are now options (and optional). Allow many
- more parameters to be specified. Consult the disk label for some
- defaults.
- (most functions): Add explicit return type declarations. Fix
- printf format specifications. Get rid of #ifdefs for MFS.
- (started, malloc, realloc, calloc, free): Functions removed.
- (mfs, membase): Variables removed.
- <stddef.h>, <stdlib.h>, <argp.h>, <assert.h>, <error.h>,
- <string.h>: New includes
- * dlabel.c: New file.
- * Makefile (SRCS): Add dlabel.c.
- (mkfs.ufs): New target.
-
-Tue Feb 27 14:52:00 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * clri.c: Move here from ../utils.
-
- [Entire directory renamed to `ufs-utils' from `newfs']
-
-Sat Sep 9 12:17:11 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * Makefile (target): Changed to `mkfs.ufs'.
- (installationdir): New variable, install into $(sbindir).
-
-Thu Nov 24 18:39:30 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * mkfs.c: Protect all mfs code with #ifdef MFS.
-
-Wed Oct 12 12:59:01 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * mkfs.c (main): MAXCONTIG should be zero because we don't
- do clustering.
-
-Fri Sep 9 09:45:23 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * mkfs.c: Include <sys/stat.h> and <fcntl.h>.
- (main): New function. Punt newfs.c for now.
- * Makefile (SRCS, OBJS): Comment out uses of newfs.c.
- (target): Build mkfs, not newfs.
-
- * newfs.c (mopts): Comment out.
- (mntflags): Comment out.
- (main): Omit check for `mfs'. Omit var `partition'.
- (main) [case 'o']: Comment out mfs specific code.
- (main): Comment out check for already-mounted partition.
- (main): Comment out MFS specific open of FSI.
-
- * mkfs.c (fsinit): Use DI_MODE to read mode from NODE, and
- set di_model and di_modeh instead of di_mode.
- (mkfs): Don't set fields in *PP.
-
- * newfs.c: Include ufs header files with "../ufs/foo.h" instead of
- <ufs/ufs/foo.h>. Don't include <sys/disklabel.h>, <sys/mount.h>,
- or "mntopts.h".
-
-Thu Sep 8 15:52:05 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * mkfs.c: Include ufs header files with "../ufs/foo.h" instead of
- <ufs/ufs/foo.h>. Don't include <sys/disklabel.h>.
-
diff --git a/ufs-utils/Makefile b/ufs-utils/Makefile
index b27b76c4..df22440e 100644
--- a/ufs-utils/Makefile
+++ b/ufs-utils/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 1994, 1996 Free Software Foundation
+# Copyright (C) 1994, 1996, 2008 Free Software Foundation
# Written by Michael I. Bushnell.
#
# This file is part of the GNU Hurd.
@@ -27,6 +27,7 @@ SRCS = mkfs.c clri.c stati.c dlabel.c
installationdir = $(sbindir)
OBJS = $(SRCS:.c=.o)
+HURDLIBS = store shouldbeinlibc
include ../Makeconf
diff --git a/ufs-utils/dlabel.c b/ufs-utils/dlabel.c
index a51fc8ec..355cb3f6 100644
--- a/ufs-utils/dlabel.c
+++ b/ufs-utils/dlabel.c
@@ -1,8 +1,8 @@
/* Get the disklabel from a device node
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996,99,2001 Free Software Foundation, Inc.
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -43,10 +43,10 @@ fd_get_device (int fd, device_t *device)
if (node == MACH_PORT_NULL)
return errno;
- err = store_create (node, 0, 0, &store);
+ err = store_create (node, 0, 0, &store); /* consumes NODE on success */
if (! err)
{
- if (store->class != STORAGE_DEVICE
+ if (store->class->id != STORAGE_DEVICE
/* In addition to requiring a device, we also want the *whole*
device -- one contiguous run starting at 0. */
|| store->num_runs != 1
@@ -63,8 +63,8 @@ fd_get_device (int fd, device_t *device)
}
store_free (store);
}
-
- mach_port_deallocate (mach_task_self (), node);
+ else
+ mach_port_deallocate (mach_task_self (), node);
return err;
}
diff --git a/ufs-utils/mkfs.c b/ufs-utils/mkfs.c
index b6303e86..aef3ea92 100644
--- a/ufs-utils/mkfs.c
+++ b/ufs-utils/mkfs.c
@@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkfs.c 8.3 (Berkeley) 2/3/94";*/
-static char *rcsid = "$Id: mkfs.c,v 1.16 1997/02/20 04:15:02 miles Exp $";
+static char *rcsid = "$Id: mkfs.c,v 1.22 2006/03/14 23:27:50 tschwinge Exp $";
#endif /* not lint */
#include <unistd.h>
@@ -63,7 +63,7 @@ static char *rcsid = "$Id: mkfs.c,v 1.16 1997/02/20 04:15:02 miles Exp $";
/* Begin misc additions for GNU Hurd */
-/* For GNU Hurd: the ufs DIRSIZ macro is different than the BSD
+/* For GNU Hurd: the ufs DIRSIZ macro is different than the BSD
4.4 version that mkfs expects. So we provide here the BSD version. */
#undef DIRSIZ
#if (BYTE_ORDER == LITTLE_ENDIAN)
@@ -90,6 +90,7 @@ static char *rcsid = "$Id: mkfs.c,v 1.16 1997/02/20 04:15:02 miles Exp $";
#ifndef STANDALONE
#include <a.out.h>
#include <stdio.h>
+#include <time.h>
#endif
/*
@@ -174,22 +175,22 @@ static const struct argp_option options[] = {
{"just-print", 'N', 0, 0,
"Just print the file system parameters that would be used"},
{"old-format", 'O', 0, 0, "Create a 4.3BSD format filesystem"},
- {"max-contig", 'a', "BLOCKS", 0,
+ {"max-contig", 'a', "BLOCKS", 0,
"The maximum number of contiguous blocks that will be laid out before"
" forcing a rotational delay; the default is no limit"},
{"block-size", 'b', "BYTES", 0, "The block size of the file system"},
{"group-cylinders", 'c', "N", 0,
"The number of cylinders per cylinder group; the default 16"},
- {"rot-delay", 'd', "MSEC", 0,
+ {"rot-delay", 'd', "MSEC", 0,
"The expected time to service a transfer completion interrupt and"
" initiate a new transfer on the same disk; the default is 0"},
- {"max-bpg", 'e', "BLOCKS", 0,
+ {"max-bpg", 'e', "BLOCKS", 0,
"Maximum number of blocks any single file can allocate out of a cylinder"
" group before it is forced to begin allocating blocks from another"
" cylinder group; the default is about one quarter of the total blocks"
" in a cylinder group"},
{"frag-size", 'f', "BYTES", 0, "The fragment size"},
- {"inode-density", 'i', "BYTES", 0,
+ {"inode-density", 'i', "BYTES", 0,
"The density of inodes in the file system, in bytes of data space per"
" inode; the default is one inode per 4 filesystem frags"},
{"minfree", 'm', "PERCENT", 0,
@@ -211,7 +212,7 @@ static const struct argp_option options[] = {
{"tracks", 't', "N", 0, "The number of tracks/cylinder"},
{"sectors", 'u', "N", 0,
"The number of sectors per track (does not include sectors reserved for"
- " bad block replacement"},
+ " bad block replacement"},
{"spare-sectors", 'p', "N", 0,
"Spare sectors (for bad sector replacement) at the end of each track"},
{"cyl-spare-sectors", 'x', "N", 0,
@@ -261,7 +262,7 @@ char *device = 0;
#define deverr(code, err, fmt, args...) \
error (code, err, "%s: " fmt, device , ##args)
-void
+int
main (int argc, char **argv)
{
int fdo, fdi;
@@ -277,11 +278,9 @@ main (int argc, char **argv)
{
case 'N': Nflag = 1; break;
case 'O': Oflag = 1; break;
-
- /* Mark &VAR as being a uparam, and return a lvalue for VAR. */
-#define UP(var) (amarks_add (&uparams, &var), var)
- /* Record an integer uparam into VAR. */
-#define UP_INT(var) { int _i = atoi (arg); UP (var) = _i; }
+
+/* Mark &VAR as being a uparam, and set VAR. */
+#define UP_INT(var) { amarks_add (&uparams, &var); var = atoi (arg); }
case 'a': UP_INT (maxcontig); break;
case 'b': UP_INT (bsize); break;
@@ -302,7 +301,7 @@ main (int argc, char **argv)
case 'p': UP_INT (nspares); break;
case 'x': UP_INT (ncspares); break;
- case 'o':
+ case 'o':
amarks_add (&uparams, &opt);
if (strcmp (arg, "time") == 0)
opt = FS_OPTTIME;
@@ -413,7 +412,7 @@ main (int argc, char **argv)
nphyssectors = nsectors + nspares;
secpercyl = nsectors * ntracks;
-
+
DEFAULT (rpm, DL_INT (0, d_rpm));
DEFAULT (interleave, DL_INT (0, d_interleave));
DEFAULT (trackskew, DL_SECS (0, d_trackskew));
@@ -422,7 +421,7 @@ main (int argc, char **argv)
DEFAULT (fsize, 1024);
DEFAULT (bsize, 8192);
-
+
DEFAULT (cpg, 16);
DEFAULT (minfree, MINFREE);
DEFAULT (opt, DEFAULTOPT);
@@ -439,7 +438,7 @@ main (int argc, char **argv)
mkfs (0, device, fdi, fdo);
- exit (0);
+ return 0;
}
void
@@ -656,7 +655,7 @@ mkfs(pp, fsys, fi, fo)
}
else
exit(23);
- /*
+ /*
* Calculate the number of cylinders per group
*/
sblock.fs_cpg = cpg;
@@ -863,6 +862,7 @@ next:
sblock.fs_cstotal.cs_nffree = 0;
sblock.fs_fmod = 0;
sblock.fs_ronly = 0;
+ sblock.fs_clean = 1;
/*
* Dump out summary information about file system.
@@ -904,7 +904,7 @@ next:
sblock.fs_cssize - i < sblock.fs_bsize ?
sblock.fs_cssize - i : sblock.fs_bsize,
((char *)fscs) + i);
- /*
+ /*
* Write out the duplicate super blocks
*/
for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
@@ -962,7 +962,7 @@ initcg(cylno, utime)
acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
acg.cg_btotoff = &acg.cg_space[0] - (u_char *)(&acg.cg_link);
acg.cg_boff = acg.cg_btotoff + sblock.fs_cpg * sizeof(long);
- acg.cg_iusedoff = acg.cg_boff +
+ acg.cg_iusedoff = acg.cg_boff +
sblock.fs_cpg * sblock.fs_nrpos * sizeof(short);
acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, NBBY);
if (sblock.fs_contigsumsize <= 0) {
@@ -1156,6 +1156,14 @@ fsinit(utime)
node.di_model = IFDIR | UMASK;
node.di_modeh = 0;
node.di_nlink = PREDEFDIR;
+
+ /* Set the uid/gid to non-root if run by a non-root user. This
+ is what mke2fs does in e2fsprogs-1.18 (actually it uses the
+ real IDs iff geteuid()!=0, but that is just wrong). */
+ node.di_uid = geteuid();
+ if (node.di_uid != 0)
+ node.di_gid = getegid();
+
if (Oflag)
node.di_size = makedir((struct directory_entry *)oroot_dir, PREDEFDIR);
else
@@ -1269,7 +1277,7 @@ iput(ip, ino)
sblock.fs_cstotal.cs_nifree--;
fscs[0].cs_nifree--;
if (ino >= sblock.fs_ipg * sblock.fs_ncg)
- deverr (32, 0, "fsinit: inode value out of range (%d)", ino);
+ deverr (32, 0, "fsinit: inode value out of range (%Ld)", ino);
d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
rdfs(d, sblock.fs_bsize, buf);
buf[ino_to_fsbo(&sblock, ino)] = *ip;
diff --git a/ufs-utils/stati.c b/ufs-utils/stati.c
index 2c0147d0..ba545bf2 100644
--- a/ufs-utils/stati.c
+++ b/ufs-utils/stati.c
@@ -61,6 +61,7 @@ static char sccsid[] __attribute__ ((unused));
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <time.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
@@ -94,7 +95,7 @@ mode_rep (unsigned short mode)
case S_IFIFO: *p++ = 'f'; break;
default: *p++ = '?';
}
-
+
add_perms (0, S_ISUID);
add_perms (3, S_ISGID);
add_perms (6, 0);