Deleted Added
full compact
vfs_mount.c (140715) vfs_mount.c (141206)
1/*-
2 * Copyright (c) 1999-2004 Poul-Henning Kamp
3 * Copyright (c) 1999 Michael Smith
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

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

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999-2004 Poul-Henning Kamp
3 * Copyright (c) 1999 Michael Smith
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

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

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 140715 2005-01-24 10:28:41Z jeff $");
38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 141206 2005-02-03 15:10:58Z pjd $");
39
40#include <sys/param.h>
41#include <sys/conf.h>
39
40#include <sys/param.h>
41#include <sys/conf.h>
42#include <sys/cons.h>
43#include <sys/jail.h>
44#include <sys/kernel.h>
42#include <sys/jail.h>
43#include <sys/kernel.h>
44#include <sys/libkern.h>
45#include <sys/mac.h>
46#include <sys/malloc.h>
47#include <sys/mount.h>
48#include <sys/mutex.h>
49#include <sys/namei.h>
50#include <sys/proc.h>
51#include <sys/filedesc.h>
52#include <sys/reboot.h>

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

68
69#ifdef DDB
70#include <ddb/ddb.h>
71#endif
72
73#define ROOTNAME "root_device"
74#define VFS_MOUNTARG_SIZE_MAX (1024 * 64)
75
45#include <sys/mac.h>
46#include <sys/malloc.h>
47#include <sys/mount.h>
48#include <sys/mutex.h>
49#include <sys/namei.h>
50#include <sys/proc.h>
51#include <sys/filedesc.h>
52#include <sys/reboot.h>

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

68
69#ifdef DDB
70#include <ddb/ddb.h>
71#endif
72
73#define ROOTNAME "root_device"
74#define VFS_MOUNTARG_SIZE_MAX (1024 * 64)
75
76static void gets(char *cp);
77static int vfs_domount(struct thread *td, const char *fstype,
78 char *fspath, int fsflags, void *fsdata);
79static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp,
80 const char *fspath, struct thread *td, struct mount **mpp);
81static int vfs_mountroot_ask(void);
82static int vfs_mountroot_try(const char *mountfrom);
83static int vfs_donmount(struct thread *td, int fsflags,
84 struct uio *fsoptions);

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

1285#if defined(__i386__) || defined(__ia64__)
1286 printf(" eg. ufs:da0s1a\n");
1287#else
1288 printf(" eg. ufs:/dev/da0a\n");
1289#endif
1290 printf(" ? List valid disk boot devices\n");
1291 printf(" <empty line> Abort manual input\n");
1292 printf("\nmountroot> ");
76static int vfs_domount(struct thread *td, const char *fstype,
77 char *fspath, int fsflags, void *fsdata);
78static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp,
79 const char *fspath, struct thread *td, struct mount **mpp);
80static int vfs_mountroot_ask(void);
81static int vfs_mountroot_try(const char *mountfrom);
82static int vfs_donmount(struct thread *td, int fsflags,
83 struct uio *fsoptions);

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

1284#if defined(__i386__) || defined(__ia64__)
1285 printf(" eg. ufs:da0s1a\n");
1286#else
1287 printf(" eg. ufs:/dev/da0a\n");
1288#endif
1289 printf(" ? List valid disk boot devices\n");
1290 printf(" <empty line> Abort manual input\n");
1291 printf("\nmountroot> ");
1293 gets(name);
1292 gets(name, sizeof(name), 1);
1294 if (name[0] == '\0')
1295 return (1);
1296 if (name[0] == '?') {
1297 printf("\nList of GEOM managed disk devices:\n ");
1298 g_dev_print();
1299 continue;
1300 }
1301 if (!vfs_mountroot_try(name))
1302 return (0);
1303 }
1304}
1305
1306/*
1293 if (name[0] == '\0')
1294 return (1);
1295 if (name[0] == '?') {
1296 printf("\nList of GEOM managed disk devices:\n ");
1297 g_dev_print();
1298 continue;
1299 }
1300 if (!vfs_mountroot_try(name))
1301 return (0);
1302 }
1303}
1304
1305/*
1307 * Local helper function for vfs_mountroot_ask.
1308 */
1309static void
1310gets(char *cp)
1311{
1312 char *lp;
1313 int c;
1314
1315 lp = cp;
1316 for (;;) {
1317 printf("%c", c = cngetc() & 0177);
1318 switch (c) {
1319 case -1:
1320 case '\n':
1321 case '\r':
1322 *lp++ = '\0';
1323 return;
1324 case '\b':
1325 case '\177':
1326 if (lp > cp) {
1327 printf(" \b");
1328 lp--;
1329 }
1330 continue;
1331 case '#':
1332 lp--;
1333 if (lp < cp)
1334 lp = cp;
1335 continue;
1336 case '@':
1337 case 'u' & 037:
1338 lp = cp;
1339 printf("%c", '\n');
1340 continue;
1341 default:
1342 *lp++ = c;
1343 }
1344 }
1345}
1346
1347/*
1348 * ---------------------------------------------------------------------
1349 * Functions for querying mount options/arguments from filesystems.
1350 */
1351
1352/*
1353 * Check that no unknown options are given
1354 */
1355int

--- 394 unchanged lines hidden ---
1306 * ---------------------------------------------------------------------
1307 * Functions for querying mount options/arguments from filesystems.
1308 */
1309
1310/*
1311 * Check that no unknown options are given
1312 */
1313int

--- 394 unchanged lines hidden ---