With this patch /etc/mtab becomes obsolete.
return(EXIT_FAILURE);
}
- /* The mount has completed successfully. Tell the user. */
- printf("%s is read-%s mounted on %s\n",
- argv[1], mountflags & MS_RDONLY ? "only" : "write", argv[2]);
-
- /* Update /etc/mtab. */
- update_mtab(argv[1], argv[2], type, mountflags);
+ printf("%s is mounted on %s\n", argv[1], argv[2]);
return(EXIT_SUCCESS);
}
-void
-update_mtab(char *dev, char *mountpoint, char *fstype, int mountflags)
-{
- int n;
- char *vs;
- char special[PATH_MAX], mounted_on[PATH_MAX], version[10], rw_flag[10];
-
- if (!write_mtab) return;
- n = load_mtab("mount");
- if (n < 0) exit(1); /* something is wrong. */
-
- /* Loop on all the /etc/mtab entries, copying each one to the output
- * buf. */
- while (1) {
- n = get_mtab_entry(special, mounted_on, version, rw_flag);
- if (n < 0) break;
- n = put_mtab_entry(special, mounted_on, version, rw_flag);
- if (n < 0) {
- std_err("mount: /etc/mtab has grown too large\n");
- exit(1);
- }
- }
- /* For MFS, use a version number. Otherwise, use the FS type name. */
- if (!strcmp(fstype, MINIX_FS_TYPE)) {
- vs = "MFSv3";
- } else if (strlen(fstype) < sizeof(version)) {
- vs = fstype;
- } else {
- vs = "-";
- }
- n = put_mtab_entry(dev, mountpoint, vs,
- (mountflags & MS_RDONLY ? "ro" : "rw") );
- if (n < 0) {
- std_err("mount: /etc/mtab has grown too large\n");
- exit(1);
- }
-
- n = rewrite_mtab("mount");
-}
-
void list()
{
int n;
- char special[PATH_MAX], mounted_on[PATH_MAX], version[10], rw_flag[10];
+ char dev[PATH_MAX], mountpoint[PATH_MAX], type[MNTNAMELEN], flags[MNTFLAGLEN];
/* Read and print /etc/mtab. */
n = load_mtab("mount");
if (n < 0) exit(1);
while (1) {
- n = get_mtab_entry(special, mounted_on, version, rw_flag);
+ n = get_mtab_entry(dev, mountpoint, type, flags);
if (n < 0) break;
- printf("%s is read-%s mounted on %s (type %s)\n",
- special, strcmp(rw_flag, "rw") == 0 ? "write" : "only",
- mounted_on, version);
+ printf("%s on %s type %s (%s)\n", dev, mountpoint, type, flags);
}
exit(0);
}
device = NULL;
if (mount(device, mountpoint, mountflags, fs->fs_vfstype,
- fs->fs_mntops) == 0) {
- update_mtab(fs->fs_spec, fs->fs_file, fs->fs_vfstype,
- mountflags);
- } else {
+ fs->fs_mntops) != 0) {
err = strerror(errno);
fprintf(stderr, "mount: Can't mount %s on %s: %s\n",
fs->fs_spec, fs->fs_file, err);
/* This program figures out what the root device is by doing a stat on it, and
* then searching /dev until it finds an entry with the same device number.
- * A typical use (probably the only use) is in /etc/rc for initializing
- * /etc/mtab, as follows:
- *
- * /usr/bin/printroot >/etc/mtab
*
* 9 Dec 1989 - clean up for 1.5 - full prototypes (BDE)
* 15 Oct 1989 - avoid ACK cc bugs (BDE):
void update_mtab(void);
void usage(void);
-static char device[PATH_MAX+1], mountpoint[PATH_MAX+1], vs[10], rw[10];
+static char device[PATH_MAX], mount_point[PATH_MAX], type[MNTNAMELEN],
+ flags[MNTFLAGLEN];
int main(argc, argv)
int argc;
char *argv[];
{
int found;
- int flags = 0UL;
- int i;
+ int umount_flags = 0UL;
char c;
char *name;
while ((c = getopt (argc, argv, "e")) != -1)
{
switch (c) {
- case 'e': flags |= MS_EXISTING; break;
+ case 'e': umount_flags |= MS_EXISTING; break;
default: break;
}
}
name = argv[optind];
-
found = find_mtab_entry(name);
-
- if (umount2(name, flags) < 0) {
+ if (umount2(name, umount_flags) < 0) {
if (errno == EINVAL)
std_err("umount: Device not mounted\n");
else if (errno == ENOTBLK)
exit(1);
}
if (found) {
- printf("%s unmounted from %s\n", device, mountpoint);
- update_mtab();
+ printf("%s unmounted from %s\n", device, mount_point);
}
- else printf("%s unmounted (mtab not updated)\n", name);
return(0);
}
* and generate a new mtab file without this entry on the fly. Do not write
* out the result yet. Return whether we found a matching entry.
*/
- char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10];
+ char e_dev[PATH_MAX], e_mount_point[PATH_MAX], e_type[MNTNAMELEN],
+ e_flags[MNTFLAGLEN];
struct stat nstat, mstat;
int n, found;
found = 0;
while (1) {
- n = get_mtab_entry(special, mounted_on, version, rw_flag);
+ n = get_mtab_entry(e_dev, e_mount_point, e_type, e_flags);
if (n < 0) break;
- if (strcmp(name, special) == 0 || (stat(mounted_on, &mstat) == 0 &&
+ if (strcmp(name, e_dev) == 0 || (stat(e_mount_point, &mstat) == 0 &&
mstat.st_dev == nstat.st_dev && mstat.st_ino == nstat.st_ino))
{
- /* If we found an earlier match, keep that one. Mountpoints
- * may be stacked on top of each other, and unmounting should
- * take place in the reverse order of mounting.
- */
- if (found) {
- (void) put_mtab_entry(device, mountpoint, vs, rw);
- }
-
- strcpy(device, special);
- strcpy(mountpoint, mounted_on);
- strcpy(vs, version);
- strcpy(rw, rw_flag);
+ strlcpy(device, e_dev, PATH_MAX);
+ strlcpy(mount_point, e_mount_point, PATH_MAX);
+ strlcpy(type, e_type, MNTNAMELEN);
+ strlcpy(flags, e_flags, MNTFLAGLEN);
found = 1;
- continue;
+ break;
}
- (void) put_mtab_entry(special, mounted_on, version, rw_flag);
}
return found;
}
-void update_mtab()
-{
-/* Write out the new mtab file. */
- int n;
-
- n = rewrite_mtab("umount");
- if (n < 0) {
- std_err("/etc/mtab not updated.\n");
- exit(1);
- }
-}
-
void usage()
{
std_err("Usage: umount [-e] name\n");
#define MS_REUSE 0x002 /* Tell RS to try reusing binary from memory */
#define MS_LABEL16 0x004 /* Mount message points to 16-byte label */
#define MS_EXISTING 0x008 /* Tell mount to use already running server */
+#define MNTNAMELEN 16 /* Length of fs type name including nul */
+#define MNTFLAGLEN 64 /* Length of flags string including nul */
int mount(char *_spec, char *_name, int _mountflags, char *type, char
*args);
/usr/tmp /var/tmp \
/usr/pkg/bin/clang /usr/bin/cc \
/usr/pkg/bin/strip /usr/bin/strip \
- /dev/kbdaux /dev/mouse
+ /dev/kbdaux /dev/mouse \
+ /proc/mounts /etc/mtab
.endif # !defined(__MINIX)
readclock || intr date -q
# Initialize files.
- printroot >/etc/mtab # /etc/mtab keeps track of mounts
>/etc/utmp # /etc/utmp keeps track of logins
# Use MFS binary only from kernel image?
;;
stop|down)
# Save random data, if /usr is mounted rw.
- if grep ' \/usr .*rw' /etc/mtab >/dev/null
+ if grep ' \/usr .*rw.*' /etc/mtab >/dev/null
then
if dd if=/dev/random of=$RANDOM_FILE.new bs=1024 count=1 2>/dev/null
then
#ifndef _MINLIB
#define _MINLIB
+#include <sys/mount.h>
+
/* Miscellaneous BSD. */
char *itoa(int _n);
#ifndef __NBSD_LIBC
int getprocessor(void);
void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
int load_mtab(char *_prog_name);
-int rewrite_mtab(char *_prog_name);
-int get_mtab_entry(char *_s1, char *_s2, char *_s3, char *_s4);
-int put_mtab_entry(char *_s1, char *_s2, char *_s3, char *_s4);
+int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
+ char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
/* read_tsc() and friends */
void read_tsc(u32_t *hi, u32_t *lo);
#define SI_DATA_STORE 5 /* get copy of data store mappings */
#define SI_CALL_STATS 9 /* system call statistics */
#define SI_PROCPUB_TAB 11 /* copy of public entries of process table */
+#define SI_VMNT_TAB 12 /* get vmnt table */
#endif
*
* load_mtab(&prog_name) - read /etc/mtab into mtab_in
* get_mtab_entry(&s1, &s2, &s3, &s4) - arrays that are filled in
- * put_mtab_entry(&s1, &s2, &s3, &s4) - append a line to mtab_out
- * rewrite_mtab(&prog_name) - write mtab_out to /etc/mtab
*
- * If load_mtab and rewrite_mtab work, they return 0. If they fail, they
- * print their own error messages on stderr and return -1. When get_mtab_entry
+ * If load_mtab works, it returns 0. If it fails, it prints its own error
+ * message on stderr and returns -1. When get_mtab_entry
* runs out of entries to return, it sets the first pointer to NULL and returns
- * -1 instead of 0. Also, rewrite_mtab returns -1 if it fails.
+ * -1 instead of 0.
*/
#include <sys/types.h>
char *etc_mtab = "/etc/mtab"; /* name of the /etc/mtab file */
static char mtab_in[BUF_SIZE+1]; /* holds /etc/mtab when it is read in */
-static char mtab_out[BUF_SIZE+1]; /* buf to build /etc/mtab for output later */
static char *iptr = mtab_in; /* pointer to next line to feed out. */
-static char *optr = mtab_out; /* pointer to place where next line goes */
int load_mtab(char *prog_name );
-int rewrite_mtab(char *prog_name );
-int get_mtab_entry(char *special, char *mounted_on, char *version, char
- *rw_flag);
-int put_mtab_entry(char *special, char *mounted_on, char *version, char
- *rw_flag);
+int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
+ char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
static void err(char *prog_name, char *str );
close(fd);
- /* Replace all the whitespace by '\0'. */
ptr = mtab_in;
- while (*ptr != '\0') {
- if (isspace(*ptr)) *ptr = '\0';
- ptr++;
- }
- return(0);
-}
-
-
-int rewrite_mtab(prog_name)
-char *prog_name;
-{
-/* Write mtab_out to /etc/mtab. */
-
- int fd, n;
- /* Do a creat to truncate the file. */
- fd = creat(etc_mtab, 0777);
- if (fd < 0) {
- err(prog_name, ": cannot overwrite ");
- return(-1);
- }
-
- /* File created. Write it. */
- n = write(fd, mtab_out, (unsigned int)(optr - mtab_out));
- if (n <= 0) {
- /* Write failed. */
- err(prog_name, " could not write ");
- return(-1);
- }
-
- close(fd);
return(0);
}
-
-int get_mtab_entry(special, mounted_on, version, rw_flag)
-char *special;
-char *mounted_on;
-char *version;
-char *rw_flag;
+int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
+ char type[MNTNAMELEN], char flags[MNTFLAGLEN])
{
/* Return the next entry from mtab_in. */
+ int r;
+
if (iptr >= &mtab_in[BUF_SIZE]) {
- special[0] = '\0';
+ dev[0] = '\0';
return(-1);
}
- strcpy(special, iptr);
- while (isprint(*iptr)) iptr++;
- while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
- strcpy(mounted_on, iptr);
- while (isprint(*iptr)) iptr++;
- while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
- strcpy(version, iptr);
- while (isprint(*iptr)) iptr++;
- while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
- strcpy(rw_flag, iptr);
- while (isprint(*iptr)) iptr++;
- while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
- return(0);
-}
-
-
-int put_mtab_entry(special, mounted_on, version, rw_flag)
-char *special;
-char *mounted_on;
-char *version;
-char *rw_flag;
-{
-/* Append an entry to the mtab_out buffer. */
-
- int n1, n2, n3, n4;
-
- n1 = strlen(special);
- n2 = strlen(mounted_on);
- n3 = strlen(version);
- n4 = strlen(rw_flag);
-
- if (optr + n1 + n2 + n3 + n4 + 5 >= &mtab_out[BUF_SIZE]) return(-1);
- strcpy(optr, special);
- optr += n1;
- *optr++ = ' ';
-
- strcpy(optr, mounted_on);
- optr += n2;
- *optr++ = ' ';
-
- strcpy(optr, version);
- optr += n3;
- *optr++ = ' ';
+ r = sscanf(iptr, "%s on %s type %s (%[^)]s\n",
+ dev, mount_point, type, flags);
+ if (r != 4) {
+ dev[0] = '\0';
+ return(-1);
+ }
- strcpy(optr, rw_flag);
- optr += n4;
- *optr++ = '\n';
+ iptr = strchr(iptr, '\n'); /* Find end of line */
+ if (iptr != NULL) iptr++; /* Move to next line */
return(0);
+
}
-
static void
err(prog_name, str)
char *prog_name, *str;
.include <bsd.own.mk>
PROG= procfs
-SRCS= buf.c main.c pid.c root.c tree.c util.c cpuinfo.c
+SRCS= buf.c main.c pid.c root.c tree.c util.c cpuinfo.c mounts.c
CPPFLAGS+= -I${NETBSDSRCDIR} -I${NETBSDSRCDIR}/servers
--- /dev/null
+#include "inc.h"
+#include "vfs/vmnt.h"
+
+extern struct mproc mproc[NR_PROCS];
+
+/*===========================================================================*
+ * root_mtab *
+ *===========================================================================*/
+void
+root_mounts(void)
+{
+ struct vmnt vmnt[NR_MNTS];
+ struct vmnt *vmp;
+ struct mproc *rmp;
+ int slot;
+
+ if (getsysinfo(VFS_PROC_NR, SI_VMNT_TAB, vmnt, sizeof(vmnt)) != OK)
+ return;
+
+ for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; vmp++) {
+ if (vmp->m_dev == NO_DEV)
+ continue;
+ if (vmp->m_fs_e == PFS_PROC_NR)
+ continue; /* Skip (special case) */
+
+ slot = _ENDPOINT_P(vmp->m_fs_e);
+ if (slot < 0 || slot >= NR_PROCS)
+ continue;
+ rmp = &mproc[slot];
+ buf_printf("%s on %s type %s (%s)\n", vmp->m_mount_dev,
+ vmp->m_mount_path, rmp->mp_name,
+ (vmp->m_flags & VMNT_READONLY) ? "ro" : "rw");
+ }
+}
--- /dev/null
+#ifndef __PROCFS_MOUNTS_H
+#define __PROCFS_MOUNTS_H__
+
+void root_mounts(void);
+
+#endif /* __PROCFS_MOUNTS_H__ */
#include <machine/pci.h>
#include <minix/dmap.h>
#include "cpuinfo.h"
+#include "mounts.h"
static void root_hz(void);
static void root_uptime(void);
{ "dmap", REG_ALL_MODE, (data_t) root_dmap },
{ "cpuinfo", REG_ALL_MODE, (data_t) root_cpuinfo },
{ "ipcvecs", REG_ALL_MODE, (data_t) root_ipcvecs },
+ { "mounts", REG_ALL_MODE, (data_t) root_mounts },
{ NULL, 0, NULL }
};
}
receive_from = MFS_PROC_NR;
- if ((r = mount_fs(DEV_IMGRD, "/", MFS_PROC_NR, 0, mount_label)) != OK)
+ r = mount_fs(DEV_IMGRD, "bootramdisk", "/", MFS_PROC_NR, 0, mount_label);
+ if (r != OK)
panic("Failed to initialize root");
receive_from = ANY;
len = sizeof(calls_stats);
break;
#endif
+ case SI_VMNT_TAB:
+ src_addr = (vir_bytes) vmnt;
+ len = sizeof(struct vmnt) * NR_MNTS;
+ break;
default:
return(EINVAL);
}
/* Perform the mount(name, mfile, mount_flags) system call. */
endpoint_t fs_e;
int r, slot, rdonly, nodev;
- char fullpath[PATH_MAX];
+ char mount_path[PATH_MAX], mount_dev[PATH_MAX];
char mount_label[LABEL_MAX];
dev_t dev;
int mflags;
nodev = (vname1_length == 0);
if (!nodev) {
/* If 'name' is not for a block special file, return error. */
- if (fetch_name(vname1, vname1_length, fullpath) != OK)
+ if (fetch_name(vname1, vname1_length, mount_dev) != OK)
return(err_code);
- if ((dev = name_to_dev(FALSE /*allow_mountpt*/, fullpath)) == NO_DEV)
+ if ((dev = name_to_dev(FALSE /*allow_mountpt*/, mount_dev)) == NO_DEV)
return(err_code);
} else {
/* Find a free pseudo-device as substitute for an actual device. */
if ((dev = find_free_nonedev()) == NO_DEV)
return(err_code);
+ strlcpy(mount_dev, "none", sizeof(mount_dev));
}
/* Fetch the name of the mountpoint */
- if (fetch_name(vname2, vname2_length, fullpath) != OK) return(err_code);
+ if (fetch_name(vname2, vname2_length, mount_path) != OK) return(err_code);
/* Do the actual job */
- return mount_fs(dev, fullpath, fs_e, rdonly, mount_label);
+ return mount_fs(dev, mount_dev, mount_path, fs_e, rdonly, mount_label);
}
*===========================================================================*/
int mount_fs(
dev_t dev,
-char mountpoint[PATH_MAX],
+char mount_dev[PATH_MAX],
+char mount_path[PATH_MAX],
endpoint_t fs_e,
int rdonly,
char mount_label[LABEL_MAX] )
} else if ((new_vmp = get_free_vmnt()) == NULL) {
return(ENOMEM);
}
-
if ((r = lock_vmnt(new_vmp, VMNT_EXCL)) != OK) return(r);
- isroot = (strcmp(mountpoint, "/") == 0);
+ strlcpy(new_vmp->m_mount_path, mount_path, PATH_MAX);
+ strlcpy(new_vmp->m_mount_dev, mount_dev, PATH_MAX);
+ isroot = (strcmp(mount_path, "/") == 0);
mount_root = (isroot && have_root < 2); /* Root can be mounted twice:
* 1: ramdisk
* 2: boot disk (e.g., harddisk)
if (!mount_root) {
/* Get vnode of mountpoint */
- lookup_init(&resolve, mountpoint, PATH_NOFLAGS, &parent_vmp, &vp);
+ lookup_init(&resolve, mount_path, PATH_NOFLAGS, &parent_vmp, &vp);
resolve.l_vmnt_lock = VMNT_EXCL;
resolve.l_vnode_lock = VNODE_WRITE;
if ((vp = eat_path(&resolve, fp)) == NULL)
vmp->m_dev = dev;
vmp->m_fs_e = PFS_PROC_NR;
strlcpy(vmp->m_label, "pfs", LABEL_MAX);
+ strlcpy(vmp->m_mount_path, "pipe", PATH_MAX);
+ strlcpy(vmp->m_mount_dev, "none", PATH_MAX);
rfp = &fproc[_ENDPOINT_P(PFS_PROC_NR)];
}
int do_umount(void);
int is_nonedev(dev_t dev);
void mount_pfs(void);
-int mount_fs(dev_t dev, char fullpath[PATH_MAX+1], endpoint_t fs_e, int
- rdonly, char mount_label[LABEL_MAX]);
+int mount_fs(dev_t dev, char mount_dev[PATH_MAX], char mount_path[PATH_MAX],
+ endpoint_t fs_e, int rdonly, char mount_label[LABEL_MAX]);
int unmount(dev_t dev, char label[LABEL_MAX]);
void unmount_all(int force);
#ifndef __VFS_VMNT_H__
#define __VFS_VMNT_H__
+#include "tll.h"
+#include "comm.h"
+
EXTERN struct vmnt {
int m_fs_e; /* FS process' kernel endpoint */
tll_t m_lock;
struct vnode *m_mounted_on; /* vnode on which the partition is mounted */
struct vnode *m_root_node; /* root vnode */
char m_label[LABEL_MAX]; /* label of the file system process */
+ char m_mount_path[PATH_MAX]; /* path on which vmnt is mounted */
+ char m_mount_dev[PATH_MAX]; /* path on which vmnt is mounted */
} vmnt[NR_MNTS];
/* vmnt flags */
block_t sizeup(char *device);
void super(zone_t zones, ino_t inodes);
void rootdir(ino_t inode);
+int dir_try_enter(zone_t z, ino_t child, char *name);
void eat_dir(ino_t parent);
void eat_file(ino_t inode, int f);
-void enter_dir(ino_t parent, char *name, ino_t child);
+void enter_dir(ino_t parent, char const *name, ino_t child);
+void enter_symlink(ino_t inode, char *link);
+d2_inode *get_inoblock(ino_t i, block_t *blockno, d2_inode **ino);
void incr_size(ino_t n, size_t count);
static ino_t alloc_inode(int mode, int usrid, int grpid);
static zone_t alloc_zone(void);
void getline(char line[LINE_LEN], char *parse[MAX_TOKENS]);
void check_mtab(char *devname);
uint32_t file_time(int f);
-void pexit(char *s);
+__dead void pexit(char const *s);
void copy(char *from, char *to, size_t count);
void print_fs(void);
int read_and_set(block_t n);
void mx_read(int blocknr, char *buf);
void mx_write(int blocknr, char *buf);
void dexit(char *s, int sectnum, int err);
-void usage(void);
+__dead void usage(void);
void *alloc_block(void);
ino_t inocount;
/*
* copied from fslib
*/
-static int bitmapsize(nr_bits, block_size)
-uint32_t nr_bits;
-size_t block_size;
+static int bitmapsize(uint32_t nr_bits, size_t blk_size)
{
block_t nr_blocks;
- nr_blocks = (int) (nr_bits / FS_BITS_PER_BLOCK(block_size));
- if (((uint32_t) nr_blocks * FS_BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks;
+ nr_blocks = (int) (nr_bits / FS_BITS_PER_BLOCK(blk_size));
+ if (((uint32_t) nr_blocks * FS_BITS_PER_BLOCK(blk_size)) < nr_bits)
+ ++nr_blocks;
return(nr_blocks);
}
/*================================================================
* directory & inode management assist group
*===============================================================*/
-void enter_dir(parent, name, child)
-ino_t parent, child;
-char *name;
+void enter_dir(ino_t parent, char const *name, ino_t child)
{
/* Enter child in parent directory */
/* Works for dir > 1 block and zone > block */
ino->d2_zone[k] = z;
}
- if(dir_try_enter(z, child, name)) {
+ if(dir_try_enter(z, child, __UNCONST(name))) {
put_block(b, (char *) inoblock);
free(inoblock);
free(indirblock);
z = indirblock[k];
if(!z) z = indirblock[k] = alloc_zone();
- if(dir_try_enter(z, child, name)) {
+ if(dir_try_enter(z, child, __UNCONST(name))) {
put_block(b, (char *) inoblock);
put_block(ino->d2_zone[V2_NR_DZONES], (char *) indirblock);
free(inoblock);
off = (n - 1) % inodes_per_block;
{
static d2_inode *inode2 = NULL;
- int n;
+ int s;
- n = sizeof(*inode2) * V2_INODES_PER_BLOCK(block_size);
- if(!inode2 && !(inode2 = malloc(n)))
+ s = sizeof(*inode2) * V2_INODES_PER_BLOCK(block_size);
+ if(!inode2 && !(inode2 = malloc(s)))
pexit("couldn't allocate a block of inodes");
get_block(b, (char *) inode2);
#if defined(__minix)
int n, r;
struct stat sb;
- char special[PATH_MAX + 1], mounted_on[PATH_MAX + 1], version[10], rw_flag[10];
+ char dev[PATH_MAX], mount_point[PATH_MAX],
+ type[MNTNAMELEN], flags[MNTFLAGLEN];
r= stat(device, &sb);
if (r == -1)
return;
}
- if (load_mtab("mkfs") < 0) return;
+ if (load_mtab(__UNCONST("mkfs")) < 0) return;
while (1) {
- n = get_mtab_entry(special, mounted_on, version, rw_flag);
+ n = get_mtab_entry(dev, mount_point, type, flags);
if (n < 0) return;
- if (strcmp(device, special) == 0) {
+ if (strcmp(device, dev) == 0) {
/* Can't mkfs on top of a mounted file system. */
fprintf(stderr, "%s: %s is mounted on %s\n",
- progname, device, mounted_on);
+ progname, device, mount_point);
exit(1);
}
}
}
-void pexit(s)
-char *s;
+__dead void pexit(char const * s)
{
fprintf(stderr, "%s: %s\n", progname, s);
if (lct != 0)
return(r);
}
-void usage()
+__dead void usage()
{
fprintf(stderr,
"Usage: %s [-12dlot] [-b blocks] [-i inodes]\n"