|
|
| version 1.8, 2004/03/04 00:03:23 | version 1.9, 2004/05/19 22:52:34 |
|---|---|
| Line 200 int unlabeled; | Line 200 int unlabeled; |
| #endif | #endif |
| char device[MAXPATHLEN]; | char device[MAXPATHLEN]; |
| char mfsdevname[256]; | |
| char *progname; | char *progname; |
| struct disklabel *getdisklabel(char *, int); | struct disklabel *getdisklabel(char *, int); |
| static void rewritelabel(char *, int, struct disklabel *); | static void rewritelabel(char *, int, struct disklabel *); |
| static void usage(void); | static void usage(void); |
| static void mfsintr(int signo); | |
| int | int |
| main(int argc, char **argv) | main(int argc, char **argv) |
| Line 222 main(int argc, char **argv) | Line 224 main(int argc, char **argv) |
| #ifdef MFS | #ifdef MFS |
| struct vfsconf vfc; | struct vfsconf vfc; |
| int error; | int error; |
| char buf[BUFSIZ]; | |
| #endif | #endif |
| vflag = 0; | vflag = 0; |
| Line 622 havelabel: | Line 623 havelabel: |
| #ifdef MFS | #ifdef MFS |
| if (mfs) { | if (mfs) { |
| struct mfs_args args; | struct mfs_args args; |
| int udev; | |
| snprintf(buf, sizeof(buf), "mfs:%d", getpid()); | snprintf(mfsdevname, sizeof(mfsdevname), "/dev/mfs%d", |
| args.fspec = buf; | getpid()); |
| args.fspec = mfsdevname; | |
| args.export.ex_root = -2; | args.export.ex_root = -2; |
| if (mntflags & MNT_RDONLY) | if (mntflags & MNT_RDONLY) |
| args.export.ex_flags = MNT_EXRDONLY; | args.export.ex_flags = MNT_EXRDONLY; |
| Line 643 havelabel: | Line 646 havelabel: |
| if (error) | if (error) |
| fatal("mfs filesystem not available"); | fatal("mfs filesystem not available"); |
| udev = (253 << 8) | (getpid() & 255) | | |
| ((getpid() & ~0xFF) << 8); | |
| if (mknod(mfsdevname, S_IFCHR | 0700, udev) < 0) | |
| printf("Warning: unable to create %s\n", mfsdevname); | |
| signal(SIGINT, mfsintr); | |
| if (mount(vfc.vfc_name, argv[1], mntflags, &args) < 0) | if (mount(vfc.vfc_name, argv[1], mntflags, &args) < 0) |
| fatal("%s: %s", argv[1], strerror(errno)); | fatal("%s: %s", argv[1], strerror(errno)); |
| if (filename) { | signal(SIGINT, SIG_DFL); |
| munmap(membase,fssize * sectorsize); | mfsintr(SIGINT); |
| } | |
| } | } |
| #endif | #endif |
| exit(0); | exit(0); |
| } | } |
| #ifdef MFS | |
| static void | |
| mfsintr(int signo) | |
| { | |
| if (filename) | |
| munmap(membase, fssize * sectorsize); | |
| remove(mfsdevname); | |
| } | |
| #endif | |
| #ifdef COMPAT | #ifdef COMPAT |
| char lmsg[] = "%s: can't read disk label; disk type must be specified"; | char lmsg[] = "%s: can't read disk label; disk type must be specified"; |
| #else | #else |