vfs_mountroot.c (5c9ef378541ddaf6c7606a454ba992c610c09dd0) | vfs_mountroot.c (6e646651d358c6de266562e0dc5c621b7ea4cd8d) |
---|---|
1/*- 2 * Copyright (c) 2010 Marcel Moolenaar 3 * Copyright (c) 1999-2004 Poul-Henning Kamp 4 * Copyright (c) 1999 Michael Smith 5 * Copyright (c) 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed --- 224 unchanged lines hidden (view full) --- 233 234 mtx_lock(&mountlist_mtx); 235 TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list); 236 mtx_unlock(&mountlist_mtx); 237 238 *mpp = mp; 239 set_rootvnode(); 240 | 1/*- 2 * Copyright (c) 2010 Marcel Moolenaar 3 * Copyright (c) 1999-2004 Poul-Henning Kamp 4 * Copyright (c) 1999 Michael Smith 5 * Copyright (c) 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed --- 224 unchanged lines hidden (view full) --- 233 234 mtx_lock(&mountlist_mtx); 235 TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list); 236 mtx_unlock(&mountlist_mtx); 237 238 *mpp = mp; 239 set_rootvnode(); 240 |
241 error = kern_symlink(td, "/", "dev", UIO_SYSSPACE); | 241 error = kern_symlinkat(td, "/", AT_FDCWD, "dev", UIO_SYSSPACE); |
242 if (error) 243 printf("kern_symlink /dev -> / returns %d\n", error); 244 245 return (error); 246} 247 248static int 249vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) --- 95 unchanged lines hidden (view full) --- 345 if (error && bootverbose) 346 printf("mountroot: unable to remount devfs under /dev " 347 "(error %d).\n", error); 348 NDFREE(&nd, NDF_ONLY_PNBUF); 349 350 if (mporoot == mpdevfs) { 351 vfs_unbusy(mpdevfs); 352 /* Unlink the no longer needed /dev/dev -> / symlink */ | 242 if (error) 243 printf("kern_symlink /dev -> / returns %d\n", error); 244 245 return (error); 246} 247 248static int 249vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) --- 95 unchanged lines hidden (view full) --- 345 if (error && bootverbose) 346 printf("mountroot: unable to remount devfs under /dev " 347 "(error %d).\n", error); 348 NDFREE(&nd, NDF_ONLY_PNBUF); 349 350 if (mporoot == mpdevfs) { 351 vfs_unbusy(mpdevfs); 352 /* Unlink the no longer needed /dev/dev -> / symlink */ |
353 error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE); | 353 error = kern_unlinkat(td, AT_FDCWD, "/dev/dev", 354 UIO_SYSSPACE, 0); |
354 if (error && bootverbose) 355 printf("mountroot: unable to unlink /dev/dev " 356 "(error %d)\n", error); 357 } 358 359 return (0); 360} 361 --- 157 unchanged lines hidden (view full) --- 519 520 len = strlen(tok); 521 mdio = malloc(sizeof(*mdio) + len + 1, M_TEMP, M_WAITOK | M_ZERO); 522 path = (void *)(mdio + 1); 523 bcopy(tok, path, len); 524 free(tok, M_TEMP); 525 526 /* Get file status. */ | 355 if (error && bootverbose) 356 printf("mountroot: unable to unlink /dev/dev " 357 "(error %d)\n", error); 358 } 359 360 return (0); 361} 362 --- 157 unchanged lines hidden (view full) --- 520 521 len = strlen(tok); 522 mdio = malloc(sizeof(*mdio) + len + 1, M_TEMP, M_WAITOK | M_ZERO); 523 path = (void *)(mdio + 1); 524 bcopy(tok, path, len); 525 free(tok, M_TEMP); 526 527 /* Get file status. */ |
527 error = kern_stat(td, path, UIO_SYSSPACE, &sb); | 528 error = kern_statat(td, 0, AT_FDCWD, path, UIO_SYSSPACE, &sb, NULL); |
528 if (error) 529 goto out; 530 531 /* Open /dev/mdctl so that we can attach/detach. */ | 529 if (error) 530 goto out; 531 532 /* Open /dev/mdctl so that we can attach/detach. */ |
532 error = kern_open(td, "/dev/" MDCTL_NAME, UIO_SYSSPACE, O_RDWR, 0); | 533 error = kern_openat(td, AT_FDCWD, "/dev/" MDCTL_NAME, UIO_SYSSPACE, 534 O_RDWR, 0); |
533 if (error) 534 goto out; 535 536 fd = td->td_retval[0]; 537 mdio->md_version = MDIOVERSION; 538 mdio->md_type = MD_VNODE; 539 540 if (root_mount_mddev != -1) { --- 497 unchanged lines hidden --- | 535 if (error) 536 goto out; 537 538 fd = td->td_retval[0]; 539 mdio->md_version = MDIOVERSION; 540 mdio->md_type = MD_VNODE; 541 542 if (root_mount_mddev != -1) { --- 497 unchanged lines hidden --- |