POV-Ray : Newsgroups : povray.off-topic : A small challenge Server Time
26 Dec 2024 02:41:17 EST (-0500)
  A small challenge (Message 1 to 3 of 3)  
From: Orchid Win7 v1
Subject: A small challenge
Date: 1 May 2014 14:15:56
Message: <53628f5c$1@news.povray.org>
Does anybody here know how to read C?

Basically, my problem is this:

root# fdisk -l /dev/sdc

Disk /dev/sdc: 320.1 GB, 320072932864 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142447 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63      128519       64228+  af  HFS / HFS+
root# mount /dev/sdc1 /mnt
root# echo $?
0
root# umount /mnt
root# mount --ro -o offset=32256,sizelimit=6576994 /dev/sdc /mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop20,
        missing codepage or helper program, or other error
        In some cases useful info is found in syslog - try
        dmesg | tail or so
root# dmesg | tail
[164258.208493] hfs: unable to find HFS+ superblock
[164398.983651] hfs: invalid secondary volume header
[164398.983654] hfs: unable to find HFS+ superblock
[164404.235785] hfs: invalid secondary volume header
[164404.235787] hfs: unable to find HFS+ superblock
[164407.461400] hfs: invalid secondary volume header
[164407.461404] hfs: unable to find HFS+ superblock

In order words, if I mount /dev/sdc1, it works perfectly. But if I mount 
/dev/sdc, passing in the byte offsets to the start and end of the first 
partition, it doesn't work at all.

By pointing my web browser at kernel.org and wandering aimlessly through 
the Linux kernel source code, I was eventually able to discover that the 
first message ("unable to find HFS+ superblock") appears on line 410 of 
fs/hfsplus/super.c - which seems like a logical enough place for 
superblock-reading code to live.

My question: Can anybody figure out why the code is actually failing? 
What is it unhappy about? What has it expecting to find that wasn't 
there? (I guess it's kinda hard to conclusively pin this down without a 
copy of the disk...)

For me, just figuring out where the various functions are defined is 
quite hard. (C has this wonderful arrangement where any part of the code 
can refer to any other part of the code, with no algorithm for ever 
discovered WHERE that code is actually defined - except for 
whole-program analysis, obviously.) Also fun is that some of the 
"functions" are actually macros. Just to mess with your head.

OTOH, considering this is an OS kernel... it's not as awful as I had 
expected.


Post a reply to this message

From: Le Forgeron
Subject: Re: A small challenge
Date: 1 May 2014 14:38:40
Message: <536294b0@news.povray.org>
Le 01/05/2014 20:16, Orchid Win7 v1 nous fit lire :
> Does anybody here know how to read C?
> 
> Basically, my problem is this:
> 
> root# fdisk -l /dev/sdc
> 
> Disk /dev/sdc: 320.1 GB, 320072932864 bytes
> 255 heads, 63 sectors/track, 38913 cylinders, total 625142447 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x00000000
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sdc1              63      128519       64228+  af  HFS / HFS+
> root# mount /dev/sdc1 /mnt
> root# echo $?
> 0
> root# umount /mnt
> root# mount --ro -o offset=32256,sizelimit=6576994 /dev/sdc /mnt
> mount: wrong fs type, bad option, bad superblock on /dev/loop20,
>        missing codepage or helper program, or other error
>        In some cases useful info is found in syslog - try
>        dmesg | tail or so
> root# dmesg | tail
> [164258.208493] hfs: unable to find HFS+ superblock
> [164398.983651] hfs: invalid secondary volume header
> [164398.983654] hfs: unable to find HFS+ superblock
> [164404.235785] hfs: invalid secondary volume header
> [164404.235787] hfs: unable to find HFS+ superblock
> [164407.461400] hfs: invalid secondary volume header
> [164407.461404] hfs: unable to find HFS+ superblock
> 
> In order words, if I mount /dev/sdc1, it works perfectly. But if I mount
> /dev/sdc, passing in the byte offsets to the start and end of the first
> partition, it doesn't work at all.

And why do you want to use sdc instead of sdc1 ?

Offset seems an option for the loop device only (aka: the disk is
actually a file). Never heard of it for normal disk. Same for sizelimit.


> 
> By pointing my web browser at kernel.org and wandering aimlessly through
> the Linux kernel source code, I was eventually able to discover that the
> first message ("unable to find HFS+ superblock") appears on line 410 of
> fs/hfsplus/super.c - which seems like a logical enough place for
> superblock-reading code to live.
> 
> My question: Can anybody figure out why the code is actually failing?
> What is it unhappy about? What has it expecting to find that wasn't
> there? (I guess it's kinda hard to conclusively pin this down without a
> copy of the disk...)
> 

Mount is tricky, but it's nothing when compared to fsck mega jumbo
trampoline.

the option for hfs are only (from man page): creator, uid, dir_umask,
file_umask, umask, session, part and quiet.

If you really want to access the content from /dev/sdc, you would need
first to copy it as a file (on another bigger disk) (with
"dd if=/dev/sdc of=whatever_file_not_on_sdc" ), and then

mount -t hfs -o ro,loop,offset=32256,sizelimit=6576994
/whatever_file_not_on_sdc /mnt

(absolute path of the file is needed by mount)


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: A small challenge
Date: 13 Jun 2014 14:09:15
Message: <539b3e4b@news.povray.org>
On 01/05/2014 07:16 PM, Orchid Win7 v1 wrote:
> Does anybody here know how to read C?
>
> Basically, my problem is this:
>
> root# mount /dev/sdc1 /mnt
> root# echo $?
> 0
> root# umount /mnt
> root# mount --ro -o offset=32256,sizelimit=6576994 /dev/sdc /mnt
> mount: wrong fs type, bad option, bad superblock on /dev/loop20,
> missing codepage or helper program, or other error
> In some cases useful info is found in syslog - try
> dmesg | tail or so

It turns out that updating to the next release of OpenSUSE completely 
fixes the issue. So that should be a five-minute job...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.