Deleted Added
full compact
dos.c (10882) dos.c (12661)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
7 * $Id: dos.c,v 1.6.2.1 1995/07/21 10:53:52 rgrimes Exp $
7 * $Id: dos.c,v 1.7 1995/09/18 16:52:26 peter Exp $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 * Copyright (c) 1995
12 * Gary J Palmer. All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions

--- 45 unchanged lines hidden (view full) ---

61Boolean
62mediaInitDOS(Device *dev)
63{
64 struct msdosfs_args args;
65
66 if (!RunningAsInit || DOSMounted)
67 return TRUE;
68
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 * Copyright (c) 1995
12 * Gary J Palmer. All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions

--- 45 unchanged lines hidden (view full) ---

61Boolean
62mediaInitDOS(Device *dev)
63{
64 struct msdosfs_args args;
65
66 if (!RunningAsInit || DOSMounted)
67 return TRUE;
68
69 if (Mkdir("/dos", NULL))
69 if (Mkdir("/dos", NULL) != RET_SUCCESS)
70 return FALSE;
71
72 memset(&args, 0, sizeof(args));
73 args.fspec = dev->devname;
74 args.uid = args.gid = 0;
75 args.mask = 0777;
76
77 if (mount(MOUNT_MSDOS, "/dos", MNT_RDONLY, (caddr_t)&args) == -1) {
70 return FALSE;
71
72 memset(&args, 0, sizeof(args));
73 args.fspec = dev->devname;
74 args.uid = args.gid = 0;
75 args.mask = 0777;
76
77 if (mount(MOUNT_MSDOS, "/dos", MNT_RDONLY, (caddr_t)&args) == -1) {
78 msgConfirm("Error mounting %s on /dos: %s (%u)\n", args.fspec, strerror(errno), errno);
78 dialog_clear();
79 msgConfirm("Error mounting %s on /dos: %s (%u)", args.fspec, strerror(errno), errno);
79 return FALSE;
80 }
80 return FALSE;
81 }
82 else
83 msgDebug("Mounted DOS device (%s) on /dos.\n", args.fspec);
81 DOSMounted = TRUE;
82 return TRUE;
83}
84
85int
84 DOSMounted = TRUE;
85 return TRUE;
86}
87
88int
86mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs)
89mediaGetDOS(Device *dev, char *file, Boolean tentative)
87{
88 char buf[PATH_MAX];
89
90{
91 char buf[PATH_MAX];
92
93 msgDebug("Request for %s from DOS\n", file);
90 snprintf(buf, PATH_MAX, "/dos/freebsd/%s", file);
94 snprintf(buf, PATH_MAX, "/dos/freebsd/%s", file);
91 if (!access(buf, R_OK))
95 if (file_readable(buf))
92 return open(buf, O_RDONLY);
93 snprintf(buf, PATH_MAX, "/dos/freebsd/dists/%s", file);
96 return open(buf, O_RDONLY);
97 snprintf(buf, PATH_MAX, "/dos/freebsd/dists/%s", file);
98 if (file_readable(buf))
99 return open(buf, O_RDONLY);
100 snprintf(buf, PATH_MAX, "/dos/%s", file);
101 if (file_readable(buf))
102 return open(buf, O_RDONLY);
103 snprintf(buf, PATH_MAX, "/dos/dists/%s", file);
94 return open(buf, O_RDONLY);
95}
96
97void
98mediaShutdownDOS(Device *dev)
99{
100 if (!RunningAsInit || !DOSMounted)
101 return;
104 return open(buf, O_RDONLY);
105}
106
107void
108mediaShutdownDOS(Device *dev)
109{
110 if (!RunningAsInit || !DOSMounted)
111 return;
102 msgDebug("Unmounting /dos\n");
103 if (unmount("/dos", MNT_FORCE) != 0)
104 msgConfirm("Could not unmount the DOS partition: %s\n", strerror(errno));
112 msgDebug("Unmounting %s from /dos\n", dev->name);
113 if (unmount("/dos", MNT_FORCE) != 0) {
114 dialog_clear();
115 msgConfirm("Could not unmount the DOS partition: %s", strerror(errno));
116 }
105 if (isDebug())
117 if (isDebug())
106 msgDebug("Unmount returned\n");
118 msgDebug("Unmount successful\n");
107 DOSMounted = FALSE;
108 return;
109}
119 DOSMounted = FALSE;
120 return;
121}