[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /proc/sys/kernel/real-root-dev
From: |
Andrew Clausen |
Subject: |
Re: /proc/sys/kernel/real-root-dev |
Date: |
Thu, 12 Dec 2002 13:56:25 +1100 |
User-agent: |
Mutt/1.4i |
On Thu, Dec 12, 2002 at 03:47:00AM +0100, Juan Pedro Vallejo wrote:
> Hello.
>
> # parted /dev/hdc
> Warning: Unable to determine if partitions are mounted via
> /proc/mounts or /etc/mtab. Make sure you don't attempt to resize or
> modify mounted file systems. (Even read-only mounted)
> Ignore/Cancel?
>
> Version 1.6.4. I don't have a /proc/sys/kernel/real-root-dev file, so
> _partition_is_root_device() always fails. Shouldn't it return "I don't
> know" instead, like _mount_table_search() does?.
This isn't quite true. If there's no /dev/root in /proc/mount, it won't
fail unconditionally.
> And why the checks in _partition_is_mounted_by_path() are not taken
> sequentially?. Like this:
Unfortunately, your code won't work. (See below)
It does seem easier to follow though.
> static int
> _partition_is_mounted_by_path (const char* path)
> {
> static int can_probe = 1;
>
> if (!can_probe)
> return 0;
>
> /* try first way */
> switch (_partition_is_root_device (path)) {
> case 1: return 1; /* it is here */
> case 0: return 0; /* it is not */
Just because you know it isn't the root device doesn't mean you know
it isn't mounted, right?
> }
> /* we don't know, try second way */
> switch (_mount_table_search ("/proc/mounts", path)) {
> case 1: return 1; /* it is here */
> case 0: return 0; /* it is not */
> }
> /* we don't know, try third way */
> switch (_mount_table_search ("/etc/mtab", path)) {
> case 1: return 1; /* it is here */
> case 0: return 0; /* it is not */
> }
> /* we don't know, try last way */
> switch (_mount_table_search ("/proc/swaps", path)) {
> case 1: return 1; /* it is here */
> case 0: return 0; /* it is not */
> }
>
> /* we still don't know, and never will */
> can_probe = 0;
>
> /* ask the animal */
> return ped_exception_throw (...) != PED_EXCEPTION_IGNORE;
> }
>
> Also, the message does not mention the other two files it looks at.
It doesn't look at the real-root-dev unconditionally. (It's
only needed if there's a /dev/root entry in /proc/mounts) It does
for /proc/swaps though, so I should add that.
Thanks,
Andrew