filesystems icon indicating copy to clipboard operation
filesystems copied to clipboard

trying to build ufs filesystem on macOS - failing

Open luckman212 opened this issue 3 years ago • 9 comments

I'm trying to build the ufs filesystem for use on macOS. My Mac is running 12.1 Monterey (ARM) and has Xcode 13.2.1

This is what I get, anyone got any idea how to fix this or if it's even fixable?

~/.../filesystems-c/unixfs/ufs $ make
cc -I/usr/local/include/fuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  unixfs_ufs.c -c -o unixfs_ufs.o
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:11:
../common/linux/linux.h:377:37: error: use of undeclared identifier 'BITS_PER_LONG'
    const unsigned long* p = addr + BITOP_WORD(offset);
                                    ^
../common/linux/linux.h:265:34: note: expanded from macro 'BITOP_WORD'
#define BITOP_WORD(nr)   ((nr) / BITS_PER_LONG)
                                 ^
../common/linux/linux.h:378:39: error: use of undeclared identifier 'BITS_PER_LONG'
    unsigned long result = offset & ~(BITS_PER_LONG-1);
                                      ^
../common/linux/linux.h:385:15: error: use of undeclared identifier 'BITS_PER_LONG'
    offset %= BITS_PER_LONG;
              ^
../common/linux/linux.h:389:25: error: use of undeclared identifier 'BITS_PER_LONG'
        tmp |= ~0UL >> (BITS_PER_LONG - offset);
                        ^
../common/linux/linux.h:390:20: error: use of undeclared identifier 'BITS_PER_LONG'
        if (size < BITS_PER_LONG)
                   ^
../common/linux/linux.h:394:17: error: use of undeclared identifier 'BITS_PER_LONG'
        size -= BITS_PER_LONG;
                ^
../common/linux/linux.h:395:19: error: use of undeclared identifier 'BITS_PER_LONG'
        result += BITS_PER_LONG;
                  ^
../common/linux/linux.h:398:21: error: use of undeclared identifier 'BITS_PER_LONG'
    while (size & ~(BITS_PER_LONG-1)) {
                    ^
../common/linux/linux.h:401:19: error: use of undeclared identifier 'BITS_PER_LONG'
        result += BITS_PER_LONG;
                  ^
../common/linux/linux.h:402:17: error: use of undeclared identifier 'BITS_PER_LONG'
        size -= BITS_PER_LONG;
                ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=a' in asm
        do_div(b, uspi->s_fpg);
        ^
../common/linux/linux.h:425:12: note: expanded from macro 'do_div'
    asm("":"=a" (__low), "=d" (__high) : "A" (n));      \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=a' in asm
../common/linux/linux.h:431:19: note: expanded from macro 'do_div'
    asm("divl %2":"=a" (__low), "=d" (__mod)        \
                  ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=A' in asm
../common/linux/linux.h:433:12: note: expanded from macro 'do_div'
    asm("":"=A" (n) : "a" (__low), "d" (__high));       \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=a' in asm
        return do_div(b, uspi->s_fpg);
               ^
../common/linux/linux.h:425:12: note: expanded from macro 'do_div'
    asm("":"=a" (__low), "=d" (__high) : "A" (n));      \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=a' in asm
../common/linux/linux.h:431:19: note: expanded from macro 'do_div'
    asm("divl %2":"=a" (__low), "=d" (__mod)        \
                  ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=A' in asm
../common/linux/linux.h:433:12: note: expanded from macro 'do_div'
    asm("":"=A" (n) : "a" (__low), "d" (__high));       \
           ^
16 errors generated.
make: *** [unixfs_ufs.o] Error 1

luckman212 avatar Jan 19 '22 15:01 luckman212

The ufs example file system is really old and has not seen an update in 7 years. If you get it to work I'll happily accept a pull request, but I don't have the time or resources to maintain the file system.

bfleischer avatar Jan 19 '22 18:01 bfleischer

@bfleischer Ok, thanks for looking. Sadly that's above my pay grade. I'm going to punt and just try to run it in an Ubuntu20 x64 VM. 😞

luckman212 avatar Jan 20 '22 13:01 luckman212

The ufs example file system is really old and has not seen an update in 7 years. If you get it to work I'll happily accept a pull request, but I don't have the time or resources to maintain the file system.

Ah crap. This was my last hope at accessing an old OpenBSD drive with most of my early-2000s blogging on it.

bixfrankonis avatar Jun 02 '23 23:06 bixfrankonis

@bixfrankonis could it help you if you use dd to make an image of the drive, and then boot OpenBSD in a VM and mount the image of the drive inside the OpenBSD VM?

ctsrc avatar Jun 04 '23 19:06 ctsrc

@bixfrankonis could it help you if you use dd to make an image of the drive, and then boot OpenBSD in a VM and mount the image of the drive inside the OpenBSD VM?

Alas, no, because I don't have room to dd a 300GB drive.

bixfrankonis avatar Jun 10 '23 04:06 bixfrankonis

@bixfrankonis I saw on your website that you have an Amazon wishlist.

If you can find a decent 1 TB SSD or a 4 TB HDD, that fits your computer, on Amazon and which does not cost more than about $75 USD like for example this one https://www.amazon.com/Seagate-IronWolf-Internal-Hard-Drive/dp/B09NHV3CK9/ and you add it to your Amazon wishlist I will order it for you and then you will be able to dd an image of your drive.

ctsrc avatar Jun 10 '23 15:06 ctsrc