chromiumos/third_party/rootdev.git
13 months agoAvoid some identifier confusion 94/66294/3 master
Chris Masone [Tue, 20 Aug 2013 01:52:52 +0000 (18:52 -0700)]
Avoid some identifier confusion

Some toolchains are confused by have a local variable with the same
name as a function. FIXIT!

BUG=None
TEST=compilashunz

Change-Id: Id7befbcfc9c2cbcd14f4a229cbc8687e1f7ad72c
Reviewed-on: https://gerrit.chromium.org/gerrit/66294
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>

14 months agoFixed reference to overlapping (the same) string. 07/61707/2 factory-4455.B factory-pit-4471.B firmware-pit-4482.B release-R30-4537.B stabilize-4443.B stabilize-4512.B
Paul Taysom [Fri, 12 Jul 2013 20:03:57 +0000 (13:03 -0700)]
Fixed reference to overlapping (the same) string.

The intent of the rootdev_get_device_slave is to allow the slave and
the device to be the same string but it is not required. Added a
test for the case where they are the same string to not do the
strncpy.

Linux has vixed the problem of a limited number of stacked devices,
so I fixed the comment that referred to it.

BUG=chromium:259893
TEST=rootdev -s

Change-Id: I04d84799e77c678f1330e1bcf72cddaf9ac68c4c
Reviewed-on: https://gerrit.chromium.org/gerrit/61707
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>

2 years agoModified rootdev to handle stacked device mappers factory-2985.B factory-2993.B factory-3004.B factory-3536.B factory-4128.B factory-4290.B factory-pit-4280.B factory-pit-4390.B factory-spring-3842.B factory-spring-4131.B factory-spring-4262.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-wolf-4389.24.B release-R25-3428.B release-R26-3701.B release-R27-3912.B release-R28-4100.B release-R29-4319.B stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-3881.0.B stabilize-3912.79.B stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B stabilize-4100.38.B stabilize-4255.B stabilize-4287.B stabilize-bluetooth-smart stabilize-spring-4100.53.B stabilize2 toolchain-3428.65.B toolchain-3701.42.B toolchainA toolchainB
Paul Taysom [Thu, 30 Aug 2012 15:33:32 +0000 (08:33 -0700)]
Modified rootdev to handle stacked device mappers

Rootdev only went down one level when traversing the device tree.
With the addition of the bootcache device mapper, we need to
go multiple levels for the -s option for rootdev.

BUG=chromium-os:25441
TEST=used it with bootcache to find boot device.

Change-Id: Ica82dc150e403d0e49e4d8074c0b920b20e4cccc
Reviewed-on: https://gerrit.chromium.org/gerrit/31851
Commit-Ready: Paul Taysom <taysom@chromium.org>
Reviewed-by: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
2 years agorootdev: Prevent infinite recursion when parsing /sys/block. factory-1412.B factory-1987.B factory-2268.16.B factory-2305.B factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B factory-2717.B factory-2723.14.B factory-2846.B factory-2848.B factory-2914.B firmware-butterfly-2788.B firmware-link-2348.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B firmware-stout-2817.B release-R17-1412.B release-R18-1660.B release-R19-2046.B release-R20-2268.B release-R21-2465.B release-R22-2723.B release-R23-2913.B stabilize stabilize-daisy stabilize-link stabilize-link-2913.278
Bryan Freed [Fri, 11 Nov 2011 21:05:30 +0000 (13:05 -0800)]
rootdev: Prevent infinite recursion when parsing /sys/block.

The mmcblk driver of the 3.0.8 kernel adds mmcblk0boot0 and mmcblk0boot1
directories under /sys/block or /sys/block/mmcblk0.  I have seen it both ways.
The device symlink in those directories points to "../../mmcblk0" which
points to the grandparent directory.

When rootdev scans /sys/block looking for a device that matches "/", it
can fall into this loop and recurse until failure.

While a proper fix would detect loops to prevent recursion, that adds
considerable complexity to the directory scan.
This relatively simple solution limits recursion depth to 5 to prevent
infinitely looping.  It will fail to find device matches beyond 5 levels
of directories, but we are nowhere near that in today's systems.  We find
matches at level 3 as best I can tell.

BUG=chromium-os:22855
TEST=Run rootdev and check for failures.

Change-Id: I9ef3aa0a6d6f8143dd0b9e012ba4bb4adfa0c73b
Reviewed-on: https://gerrit.chromium.org/gerrit/11575
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Ready: Bryan Freed <bfreed@chromium.org>
Tested-by: Bryan Freed <bfreed@chromium.org>
4 years agorootdev: fix -d, add -c and -r. ifdefs for so use 0.11.241.B 0.11.257.B 0.11.257.B90 0.12.362.B 0.12.369.B 0.12.392.B 0.12.433.B 0.12.433.B109 0.12.433.B62 0.13.434.B 0.13.509.B 0.13.558.B 0.13.587.B 0.14.811.B 0.15.877.B 11.1.241.B 780.B factory-1020.B factory-1235.B factory-1284.B factory-980.B firmware-881-u-boot-v1 firmware-kiev-2.112.B firmware-u-boot-v1 firmware-uboot_v2-1299.B release-1011.B release-R16-1193.B test-982.B
Will Drewry [Mon, 30 Aug 2010 15:13:34 +0000 (10:13 -0500)]
rootdev: fix -d, add -c and -r. ifdefs for so use

Multiple changes:
- Ensure the -d flag trims off all of the partition info and only if there is a partition
- Add -c, device node creation for platform-agnostic /dev/ROOT, /dev/ROOT0 and /dev/ROOT1
- Add -r, resolve the first slave if the device is a device-mapper device
- Add -s, create a symlink from the found device to /dev/ACTIVE_ROOT
- Adds short-circuiting if /dev/ACTIVE_ROOT exists to both dm resolution and
  normal lookups
- Add support for building a library with a reusable header and interfaces

I'll follow this up with a change to install <rootdev/rootdev.h> and the .so in
the ebuild if the interface is at all interesting.  If prefered, I can just add:
rootdev -s -r to chromeos_startup, then AU can just rely on readlink(/dev/ACTIVE_ROOT).

BUG=chromium-os:5988
TEST=built for x86-generic testing with vroot: -r, -s, -c, -d and combos
     switching to non-vroot to test now
     can someone test arm for me?

Change-Id: Ibab8072afb012ea77d457517f1849e0917d02892

Review URL: http://codereview.chromium.org/3141038

4 years agorootdev.c: Added -d option to strip trailing partition number
Kobi Cohen-Arazi [Mon, 26 Jul 2010 18:48:36 +0000 (12:48 -0600)]
rootdev.c: Added -d option to strip trailing partition number

Change-Id: I2afbb0a8546f48224292433e2efcf0a868c7a1c6

Review URL: http://codereview.chromium.org/2814040
Patch from Kobi Cohen-Arazi <kobic@codeaurora.org>.

4 years agorootdev: cleanup, remove files symlink
Zdenek Behan [Tue, 15 Jun 2010 21:59:48 +0000 (14:59 -0700)]
rootdev: cleanup, remove files symlink

deleted:    files

Review URL: http://codereview.chromium.org/2815007

4 years agorootdev: fix review inheritance for rootdev repo
Zdenek Behan [Tue, 15 Jun 2010 21:05:10 +0000 (14:05 -0700)]
rootdev: fix review inheritance for rootdev repo

new file:   inherit-review-settings-ok

Review URL: http://codereview.chromium.org/2816005

4 years agorootdev: rework the repo into a "new eclass"-friendly layout
Zdenek Behan [Tue, 15 Jun 2010 18:26:35 +0000 (11:26 -0700)]
rootdev: rework the repo into a "new eclass"-friendly layout

* Move all files from files/ to .
* Fix LICENCE symlink
* Create files -> . symlink to remain backwards compatible

Review URL: http://codereview.chromium.org/2847007

4 years agoAdding source for rootdev utility.
Bill Richardson [Tue, 16 Mar 2010 20:05:12 +0000 (13:05 -0700)]
Adding source for rootdev utility.