misc/hfsplus -fno-common

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

misc/hfsplus -fno-common

Thaison Nguyen
This should fix compilation of misc/hfsplus. Patch taken from Debian people.

However, I was not able to mount any hfsplus volume, I always get the following error:

obsd# hpmount -r /dev/rsd1i
hpmount: /dev/rsd1i: This is not a HFS+ volume (Unknown error: -1)

Anyone had this working/knows how to use this?


hfsplus.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: misc/hfsplus -fno-common

George Koehler-2
On Sat, 6 Feb 2021 11:53:22 +0100
Thaison Nguyen <[hidden email]> wrote:

> This should fix compilation of misc/hfsplus. Patch taken from Debian people.

Debian's patch looks wrong to me, because it changes a global variable
to static (and duplicates the variable in each file).  I prefer
Gentoo's patch, see end of this mail; but I might make other changes
before I commit it.

> However, I was not able to mount any hfsplus volume, I always get the following error:
>
> obsd# hpmount -r /dev/rsd1i
> hpmount: /dev/rsd1i: This is not a HFS+ volume (Unknown error: -1)
>
> Anyone had this working/knows how to use this?

It doesn't work for me.  I tried on amd64 with an old Mac DVD with an
Apple partition map with an HFS+ filesystem.  The amd64 kernel doesn't
understand the Apple partition map, so there was no cd0i.  I tried to
"hpmount -r /dev/cd0c" but it didn't find the HFS+.

archivers/p7zip can extract some Apple partition maps and HFS+
filesystems.  I used "7z -tapm l /dev/cd0c" to list the map and
"7z -tapm x /dev/cd0c Mac_OS_X.hfs" to extract the 2.6G filesystem.
Now "7z l Mac_OS_X.hfs" can see the files, and "file Mac_OS_X.hfs"
identifies it as "Macintosh HFS Extended", which means HFS+, but

$ hpmount -r Mac_OS_X.hfs                                            
hpmount: /home/kernigh/Mac_OS_X.hfs: This is not a HFS+ volume (Unknown error: -1)

I have not yet tried to fix this error.    --George

Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/hfsplus/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- Makefile 26 Jan 2020 11:14:32 -0000 1.34
+++ Makefile 10 Feb 2021 04:06:21 -0000
@@ -5,7 +5,7 @@ COMMENT= hfsplus filesystem access tool
 VERSION= 1.0.4
 DISTNAME= hfsplus_${VERSION}
 PKGNAME= hfsplus-${VERSION}
-REVISION= 6
+REVISION= 7
 SHARED_LIBS= hfsp 0.0
 
 CATEGORIES= misc
Index: patches/patch-libhfsp_src_fscheck_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-libhfsp_src_fscheck_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-libhfsp_src_fscheck_c
--- patches/patch-libhfsp_src_fscheck_c 6 Feb 2011 16:03:55 -0000 1.1
+++ patches/patch-libhfsp_src_fscheck_c 10 Feb 2021 04:06:21 -0000
@@ -1,7 +1,23 @@
 $OpenBSD: patch-libhfsp_src_fscheck_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
---- libhfsp/src/fscheck.c.orig Mon Mar 25 15:48:37 2002
-+++ libhfsp/src/fscheck.c Sat Jan 29 06:01:31 2011
-@@ -204,7 +204,8 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
+
+Fix -fno-common by moving fsck_data, from Gentoo
+https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/hfsplusutils/files/hfsplusutils-1.0.4-fno-common-gcc10.patch
+
+Do other changes to unbreak the build.
+
+Index: libhfsp/src/fscheck.c
+--- libhfsp/src/fscheck.c.orig
++++ libhfsp/src/fscheck.c
+@@ -47,6 +47,8 @@
+ # include "os.h"
+ # include "swab.h"
+
++struct fsck_data_t fsck_data;
++
+ /* Dump all raw fork information to stdout */
+ void print_fork(hfsp_fork_raw* f)
+ {
+@@ -204,7 +206,8 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
   */
  static int fscheck_volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
  {
@@ -11,7 +27,7 @@ $OpenBSD: patch-libhfsp_src_fscheck_c,v
      {
  printf("Unexpected Volume signature '%2s' expected 'H+'\n",
  (char*) &vh->signature);
-@@ -230,7 +231,7 @@ static int fscheck_volume_readbuf(volume * vol, hfsp_v
+@@ -230,7 +233,7 @@ static int fscheck_volume_readbuf(volume * vol, hfsp_v
      vh->write_count = bswabU32_inc(p);
      vh->encodings_bmp = bswabU64_inc(p);
      memcpy(vh->finder_info, p, 32);
@@ -20,7 +36,7 @@ $OpenBSD: patch-libhfsp_src_fscheck_c,v
      p = volume_readfork(p, &vh->alloc_file );
      p = volume_readfork(p, &vh->ext_file   );
      p = volume_readfork(p, &vh->cat_file   );
-@@ -277,12 +278,12 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
+@@ -277,12 +280,12 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
     printf("Volume is wrapped in HFS volume "
    " (use hfsck to check this)\n");
 
Index: patches/patch-libhfsp_src_fscheck_h
===================================================================
RCS file: patches/patch-libhfsp_src_fscheck_h
diff -N patches/patch-libhfsp_src_fscheck_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libhfsp_src_fscheck_h 10 Feb 2021 04:06:21 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+Fix -fno-common by moving fsck_data, from Gentoo
+https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/hfsplusutils/files/hfsplusutils-1.0.4-fno-common-gcc10.patch
+
+Index: libhfsp/src/fscheck.h
+--- libhfsp/src/fscheck.h.orig
++++ libhfsp/src/fscheck.h
+@@ -100,10 +100,11 @@ int fscheck_btree(btree *bt);
+ int fscheck_files(volume* vol);
+
+ /** global data used during fsck */
+-struct {
++struct fsck_data_t {
+     UInt32  maxCnid;
+     UInt32  macNow; // current date in mac-offset
+     int    verbose;
+     int    ignoreErr;
+-} fsck_data;
++};
+
++extern struct fsck_data_t fsck_data;

Reply | Threaded
Open this post in threaded view
|

Re: misc/hfsplus -fno-common

George Koehler-2
On Tue, 9 Feb 2021 23:21:08 -0500
George Koehler <[hidden email]> wrote:

> On Sat, 6 Feb 2021 11:53:22 +0100
> Thaison Nguyen <[hidden email]> wrote:
>
> > obsd# hpmount -r /dev/rsd1i
> > hpmount: /dev/rsd1i: This is not a HFS+ volume (Unknown error: -1)

Here's the diff that I want to commit.  Thaison, does this work with
your HFS+ drive?  OpenBSD devs, is this ok to commit?

misc/hfsplus is old code from 2002 and has 2 problems:

  1. It is broken on LP64_ARCHS (like amd64), because the C code
     assumes sizeof(long) == 4.

  2. It is broken when the HFS+ has no HFS wrapper.  (My old macppc
     DVD from 2005 is new enough to lack a wrapper.  A text file in
     the wrapper would tell users of Mac OS < 8.1 that HFS+ requires
     Mac OS >= 8.1.)

In this diff:
  - Simplify Makefile by setting AUTORECONF.
  - Fix LP64_ARCHS by changing UInt32 and like from long to int.
     - Most of this diff is "%ld" -> "%d" in printf()s.
  - Fix -fno-common from Gentoo.
  - Fix HFS+ with no HFS wrapper by setting vol->maxblocks.
  - In src/copyout.c, fix passing &size to int *lenptr.

For example, copy private/etc/passwd from my old DVD:
$ hpmount -rp1 /dev/cd0c    # -p1 only for Apple partition map
$ hpcd private
$ hpcd etc                  # private/etc doesn't work
$ hpcopy passwd .
$ hpumount

Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/hfsplus/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- Makefile 26 Jan 2020 11:14:32 -0000 1.34
+++ Makefile 12 Feb 2021 05:29:54 -0000
@@ -5,7 +5,7 @@ COMMENT= hfsplus filesystem access tool
 VERSION= 1.0.4
 DISTNAME= hfsplus_${VERSION}
 PKGNAME= hfsplus-${VERSION}
-REVISION= 6
+REVISION= 7
 SHARED_LIBS= hfsp 0.0
 
 CATEGORIES= misc
@@ -22,12 +22,9 @@ USE_GMAKE= Yes
 
 AUTOCONF_VERSION= 2.59
 AUTOMAKE_VERSION= 1.9
-BUILD_DEPENDS= ${MODGNU_AUTOCONF_DEPENDS} \
- ${MODGNU_AUTOMAKE_DEPENDS}
-# needs the AM_PROG_LIBTOOL macro                                          
-BUILD_DEPENDS+= devel/libtool
+AUTORECONF= ${MAKE_PROGRAM} -f Makefile.cvs all
 
-CONFIGURE_STYLE= gnu
+CONFIGURE_STYLE= gnu autoreconf
 CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
  LDFLAGS="-L${LOCALBASE}/lib" \
  CFLAGS="${CFLAGS} -fgnu89-inline"
@@ -37,10 +34,7 @@ WRKDIST= ${WRKDIR}/hfsplus-${VERSION}
 DOC= bugs.html hfsp.html libhfsp.html
 
 post-patch:
- @cd ${WRKDIST} && ln -s ${LOCALBASE}/share/libtool/config/ltmain.sh \
- @cd ${WRKDIST} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
- AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
- ${MAKE_PROGRAM} -f Makefile.cvs all
+ @cd ${WRKDIST} && ln -s ${LOCALBASE}/share/libtool/config/ltmain.sh .
 
 post-install:
  ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/hfsplus/
Index: patches/patch-libhfsp_src_apple_h
===================================================================
RCS file: patches/patch-libhfsp_src_apple_h
diff -N patches/patch-libhfsp_src_apple_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libhfsp_src_apple_h 12 Feb 2021 05:29:54 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Index: libhfsp/src/apple.h
+--- libhfsp/src/apple.h.orig
++++ libhfsp/src/apple.h
+@@ -33,9 +33,9 @@ typedef signed char    SInt8;
+ typedef unsigned char    UInt8;
+ typedef signed short    SInt16;
+ typedef unsigned short    UInt16;
+-typedef signed long    SInt32;
+-typedef unsigned long    UInt32;
+-typedef unsigned long    OSType;
++typedef signed int    SInt32;
++typedef unsigned int    UInt32;
++typedef unsigned int    OSType;
+ typedef unsigned long long  UInt64;
+
+ #define PARTITION_SIG    0x504d   /* 'PM' */
Index: patches/patch-libhfsp_src_btreecheck_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-libhfsp_src_btreecheck_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-libhfsp_src_btreecheck_c
--- patches/patch-libhfsp_src_btreecheck_c 6 Feb 2011 16:03:55 -0000 1.1
+++ patches/patch-libhfsp_src_btreecheck_c 12 Feb 2021 05:29:54 -0000
@@ -1,6 +1,124 @@
 $OpenBSD: patch-libhfsp_src_btreecheck_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
---- libhfsp/src/btreecheck.c.orig Tue Mar  5 19:50:29 2002
-+++ libhfsp/src/btreecheck.c Fri Jan 28 07:34:59 2011
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Other changes unbreak the build.
+
+Index: libhfsp/src/btreecheck.c
+--- libhfsp/src/btreecheck.c.orig
++++ libhfsp/src/btreecheck.c
+@@ -57,7 +57,7 @@ static void record_print_key(hfsp_cat_key* key)
+ {
+     char buf[255]; // mh this _might_ overflow
+     unicode_uni2asc(buf, &key->name, 255);  
+-    printf("parent cnid         : %ld\n",   key->parent_cnid);
++    printf("parent cnid         : %d\n",   key->parent_cnid);
+     printf("name                : %s\n", buf);
+ }
+
+@@ -87,19 +87,19 @@ static int fscheck_checkbtree(btree* bt)
+     */
+     if (head->root >= node_count)
+     {
+- printf("root node out of range %lX >= %lX\n",
++ printf("root node out of range %X >= %X\n",
+ head->root, node_count);
+ result |= FSCK_ERR; // This is really evil
+     }
+     if (head->leaf_head >= node_count)
+     {
+- printf("leaf_head out of range %lX >= %lX\n",
++ printf("leaf_head out of range %X >= %X\n",
+ head->leaf_head, node_count);
+ result |= FSCK_ERR; // dont know how to fix that by now
+     }
+     if (head->leaf_tail >= node_count)
+     {
+- printf("leaf_head out of range %lX >= %lX\n",
++ printf("leaf_head out of range %X >= %X\n",
+ head->leaf_tail, node_count);
+ result |= FSCK_ERR; // dont know how to fix that by now
+     }
+@@ -117,14 +117,14 @@ static int fscheck_checkbtree(btree* bt)
+     }
+     if (head->free_nodes >= node_count)
+     {
+- printf("free_nodes out of range %lX >= %lX\n",
++ printf("free_nodes out of range %X >= %X\n",
+ head->free_nodes, node_count);
+ result |= FSCK_ERR; // dont know how to fix that by now
+     }
+     // head->reserved1 nothing to check here
+     if (head->clump_size % blocksize)
+     {
+- printf("clump_size %ld not a multiple of blocksize %ld\n",
++ printf("clump_size %d not a multiple of blocksize %d\n",
+ head->free_nodes, blocksize);
+ result |= FSCK_ERR; // dont know how to fix that by now
+     }
+@@ -136,7 +136,7 @@ static int fscheck_checkbtree(btree* bt)
+     // head->reserved2  nothing to check here
+     if (head->attributes & HFSPLUS_TREE_RESERVED)
+     {
+- printf("Unexpected bits in btree header node attributes %lX\n",
++ printf("Unexpected bits in btree header node attributes %X\n",
+    head->attributes);
+ result |= FSCK_ERR; // dont know how to fix that by now
+     }
+@@ -149,16 +149,16 @@ static void btree_printhead(btree_head* head)
+ {
+     UInt32 attr;
+     printf("  depth       : %#X\n",  head->depth);
+-    printf("  root        : %#lX\n", head->root);
+-    printf("  leaf_count  : %#lX\n", head->leaf_count);
+-    printf("  leaf_head   : %#lX\n", head->leaf_head);
+-    printf("  leaf_tail   : %#lX\n", head->leaf_tail);
++    printf("  root        : %#X\n",  head->root);
++    printf("  leaf_count  : %#X\n",  head->leaf_count);
++    printf("  leaf_head   : %#X\n",  head->leaf_head);
++    printf("  leaf_tail   : %#X\n",  head->leaf_tail);
+     printf("  node_size   : %#X\n",  head->node_size);
+     printf("  max_key_len : %#X\n",  head->max_key_len);
+-    printf("  node_count  : %#lX\n", head->node_count);
+-    printf("  free_nodes  : %#lX\n", head->free_nodes);
++    printf("  node_count  : %#X\n",  head->node_count);
++    printf("  free_nodes  : %#X\n",  head->free_nodes);
+     printf("  reserved1   : %#X\n",  head->reserved1);
+-    printf("  clump_size  : %#lX\n", head->clump_size);
++    printf("  clump_size  : %#X\n",  head->clump_size);
+     printf("  btree_type  : %#X\n",  head->btree_type);
+     attr = head->attributes;
+     printf("  reserved2   : %#X\n",  head->reserved2);
+@@ -183,9 +183,9 @@ static void btree_printhead(btree_head* head)
+
+ static void print_node_desc(UInt32 nodeIndex, btree_node_desc* node)
+ {
+-    printf("Node descriptor for Node %ld\n", nodeIndex);
+-    printf("next     : %#lX\n", node->next);
+-    printf("prev     : %#lX\n", node->prev);
++    printf("Node descriptor for Node %d\n", nodeIndex);
++    printf("next     : %#X\n",  node->next);
++    printf("prev     : %#X\n",  node->prev);
+     printf("height   : %#X\n",  node->height);
+     printf("num_rec  : %d\n",   node->num_rec);
+     printf("reserved : %#X\n",  node->reserved);
+@@ -225,13 +225,13 @@ static int fscheck_btree_init(btree* bt, volume* vol,
+ HFSP_EXTENT_DATA, bt->cnid);
+     if (!p)
+     {
+- printf("Unable to read block 1 of b*tree for cnid:%ld\n", bt->cnid);
++ printf("Unable to read block 1 of b*tree for cnid:%d\n", bt->cnid);
+ return FSCK_ERR;
+     }
+     p = btree_readnode(node, p);
+     if (node->prev != 0)
+     {
+- printf("Backlink of header node is not zero (%lX) \n", node->prev);
++ printf("Backlink of header node is not zero (%X) \n", node->prev);
+ return FSCK_ERR; // ToDo: We might ignore it but ???
+     }
+     if (node->kind != HFSP_NODE_HEAD)
 @@ -264,7 +264,7 @@ static int fscheck_btree_init(btree* bt, volume* vol,
  {
     p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
@@ -10,7 +128,13 @@ $OpenBSD: patch-libhfsp_src_btreecheck_c
  }
 
  bt->alloc_bits = malloc(alloc_size);
-@@ -368,7 +368,7 @@ static void* checkbtree_key_by_index(btree* bt, UInt32
+@@ -363,12 +363,12 @@ static void* checkbtree_key_by_index(btree* bt, UInt32
+     }
+     if (fsck_data.verbose)
+     {
+- printf("Node %4ld, Record %2d is at pos %04X,"
++ printf("Node %4d, Record %2d is at pos %04X,"
+       "Backptr is at offset %04X\n", node, index, offset, off_pos);
      }
      // now we have the offset and can read the key ...
  #if BYTE_ORDER == LITTLE_ENDIAN
@@ -19,3 +143,198 @@ $OpenBSD: patch-libhfsp_src_btreecheck_c
  #else
      return buf->node + offset;
  #endif
+@@ -392,7 +392,7 @@ static int fscheck_fix_node(btree* bt, UInt32 nodeInde
+     void*     current = node->node + 0x0E; // sizeof (btree_node_desc)
+     char     kbuf[bt->head.max_key_len]; // dummy key to skip over
+     char     buf[bt->max_rec_size];
+-    fprintf(stderr, "Node %lu with %u records is damaged trying to fix ***\n",
++    fprintf(stderr, "Node %u with %u records is damaged trying to fix ***\n",
+ nodeIndex, num_rec);
+     for (i=0; i < num_rec; i++)
+     {
+@@ -402,7 +402,7 @@ static int fscheck_fix_node(btree* bt, UInt32 nodeInde
+ if (p != current)
+ {
+    fprintf(stderr,
+- "Key %u in Node %lu is damaged "
++ "Key %u in Node %u is damaged "
+ "rest of keys will be droppend ***\n", i,nodeIndex);
+    break;
+ }
+@@ -450,7 +450,7 @@ static int fscheck_btree_node(btree* bt, UInt32 nodeIn
+ if (p < previous)
+ {   // This may happen when the cache entry was flushed, but per
+    // design of the cache this should not happen, mmh
+-    printf("Backpointers in Node %ld index %d out of order "
++    printf("Backpointers in Node %d index %d out of order "
+   "(%p >= %p)\n", nodeIndex, i, p, previous);
+    result |= FSCK_FSCORR; // Hope we can correct that later
+ }
+@@ -471,7 +471,7 @@ static int fscheck_btree_node(btree* bt, UInt32 nodeIn
+    int comp = bt->kcomp(*key1, *key2);
+    if (comp > 0)
+    {
+- printf("Invalid key order in node %ld record %d\n key1=",
++ printf("Invalid key order in node %d record %d\n key1=",
+ nodeIndex, i);
+ record_print_key((hfsp_cat_key*) *key1);
+ printf("Invalid key order key2=\n");
+@@ -480,7 +480,7 @@ static int fscheck_btree_node(btree* bt, UInt32 nodeIn
+    }
+    if (comp == 0 && i > 0) // equal to key in parent node is ok
+    {
+- printf("Duplicate key in node %ld record %d key1=\n",
++ printf("Duplicate key in node %d record %d key1=\n",
+ nodeIndex, i);
+ record_print_key((hfsp_cat_key*) *key1);
+ printf("Duplicate key key2=\n");
+@@ -535,10 +535,10 @@ static void record_print_Rect(Rect* r)
+ /* print permissions */
+ static void record_print_perm(hfsp_perm* perm)
+ {
+-    printf("owner               : %ld\n",  perm->owner);
+-    printf("group               : %ld\n",  perm->group);
+-    printf("perm                : 0x%lX\n",perm->mode);
+-    printf("dev                 : %ld\n",  perm->dev);
++    printf("owner               : %d\n",   perm->owner);
++    printf("group               : %d\n",   perm->group);
++    printf("perm                : 0x%X\n", perm->mode);
++    printf("dev                 : %d\n",   perm->dev);
+ }
+
+ /* print Directory info */
+@@ -554,17 +554,17 @@ static void record_print_DInfo(DInfo* dinfo)
+ static void record_print_DXInfo(DXInfo* xinfo)
+ {
+     printf(  "frScroll            : ");    record_print_Point(&xinfo->frScroll);
+-    printf("\nfrOpenChain         : %ld\n",  xinfo->frOpenChain);
++    printf("\nfrOpenChain         : %d\n",   xinfo->frOpenChain);
+     printf(  "frUnused            : %d\n",   xinfo->frUnused);
+     printf(  "frComment           : %d\n",   xinfo->frComment);
+-    printf(  "frPutAway           : %ld\n",  xinfo->frPutAway);
++    printf(  "frPutAway           : %d\n",   xinfo->frPutAway);
+ }
+
+ static void record_print_folder(hfsp_cat_folder* folder)
+ {
+     printf("flags               : 0x%X\n", folder->flags);
+-    printf("valence             : 0x%lX\n", folder->valence);
+-    printf("id                  : %ld\n", folder->id);
++    printf("valence             : 0x%X\n", folder->valence);
++    printf("id                  : %d\n", folder->id);
+     printf("create_date         : %s", get_atime(folder->create_date));
+     printf("content_mod_date    : %s", get_atime(folder->content_mod_date));
+     printf("attribute_mod_date  : %s", get_atime(folder->attribute_mod_date));
+@@ -573,8 +573,8 @@ static void record_print_folder(hfsp_cat_folder* folde
+     record_print_perm (&folder->permissions);
+     record_print_DInfo (&folder->user_info);
+     record_print_DXInfo (&folder->finder_info);
+-    printf("text_encoding       : 0x%lX\n", folder->text_encoding);
+-    printf("reserved            : 0x%lX\n", folder->reserved);
++    printf("text_encoding       : 0x%X\n", folder->text_encoding);
++    printf("reserved            : 0x%X\n", folder->reserved);
+ }
+
+ /* print File info */
+@@ -593,15 +593,15 @@ static void record_print_FXInfo(FXInfo* xinfo)
+     printf(  "fdIconID            : %d\n",   xinfo->fdIconID);
+     // xinfo -> fdUnused;
+     printf(  "fdComment           : %d\n",   xinfo->fdComment);
+-    printf(  "fdPutAway           : %ld\n",  xinfo->fdPutAway);
++    printf(  "fdPutAway           : %d\n",  xinfo->fdPutAway);
+ }
+
+ /* print file entry */
+ static void record_print_file(hfsp_cat_file* file)
+ {
+     printf("flags               : 0x%X\n", file->flags);
+-    printf("reserved1           : 0x%lX\n", file->reserved1);
+-    printf("id                  : %ld\n", file->id);
++    printf("reserved1           : 0x%X\n", file->reserved1);
++    printf("id                  : %d\n", file->id);
+     printf("create_date         : %s", get_atime(file->create_date));
+     printf("content_mod_date    : %s", get_atime(file->content_mod_date));
+     printf("attribute_mod_date  : %s", get_atime(file->attribute_mod_date));
+@@ -610,8 +610,8 @@ static void record_print_file(hfsp_cat_file* file)
+     record_print_perm (&file->permissions);
+     record_print_FInfo (&file->user_info);
+     record_print_FXInfo (&file->finder_info);
+-    printf("text_encoding       : 0x%lX\n", file->text_encoding);
+-    printf("reserved            : 0x%lX\n", file->reserved2);
++    printf("text_encoding       : 0x%X\n", file->text_encoding);
++    printf("reserved            : 0x%X\n", file->reserved2);
+     printf("Datafork:\n");
+     print_fork (&file->data_fork);
+     printf("Rsrcfork:\n");
+@@ -623,7 +623,7 @@ static void record_print_thread(hfsp_cat_thread* entry
+ {
+     char buf[255]; // mh this _might_ overflow
+     unicode_uni2asc(buf, &entry->nodeName, 255);  
+-    printf("parent cnid         : %ld\n", entry->parentID);
++    printf("parent cnid         : %d\n",  entry->parentID);
+     printf("name                : %s\n" , buf);
+ }
+
+@@ -691,7 +691,7 @@ static int fscheck_cat_key(record* r)
+
+     if (key->parent_cnid >= cnid)
+     {
+- printf("parent_cnid %ld >= volume next cnid %ld\n",
++ printf("parent_cnid %d >= volume next cnid %d\n",
+    key->parent_cnid, cnid);
+ result |= FSCK_FSCORR; // hope we can fix that some time
+     }
+@@ -710,7 +710,7 @@ static int fscheck_mactime(UInt32 time, char* errname)
+ printf("Warning %s is 0\n", errname);
+     */
+     if (time > fsck_data.macNow)
+- printf("Warning %21.21s is in the future: (%lX) %s",
++ printf("Warning %21.21s is in the future: (%X) %s",
+ errname, time, get_atime(time));
+
+     return FSCK_NOERR; // Those are not really bad, just annoying
+@@ -732,7 +732,7 @@ static int fscheck_file(btree* tree, hfsp_cat_file* fi
+     // file->reserved1 // Nothing to check here
+     if (file->id >= cnid)
+     {
+- printf("file id %ld >= volume next cnid %ld\n",
++ printf("file id %d >= volume next cnid %d\n",
+    file->id, cnid);
+ result |= FSCK_FSCORR; // hope we can fix that some time
+     }
+@@ -769,7 +769,7 @@ static int fscheck_folder(btree* tree, hfsp_cat_folder
+     // folder->valence // to be checked later
+     if (folder->id >= cnid)
+     {
+- printf("Folder id %ld >= volume next cnid %ld\n",
++ printf("Folder id %d >= volume next cnid %d\n",
+    folder->id, cnid);
+ result |= FSCK_FSCORR; // hope we can fix that some time
+     }
+@@ -798,7 +798,7 @@ static int fscheck_thread(btree* tree, hfsp_cat_thread
+
+     if (thread->parentID >= cnid)
+     {
+- printf("Thread parentID %ld >= volume next cnid %ld\n",
++ printf("Thread parentID %d >= volume next cnid %d\n",
+    thread->parentID, cnid);
+ result |= FSCK_FSCORR; // hope we can fix that some time
+     }
+@@ -899,7 +899,7 @@ int fscheck_record_init(record* r, btree* bt, node_buf
+     { // structure (should happen while debugging only)
+ fprintf(stderr,
+    "Unexpected difference in Node %d, Record %d "
+-    ": %d (%d/%d) (%p,%p)\n",
++    ": %d (%zd/%zd) (%p,%p)\n",
+    r->node_index, index, diff , p - p1, p2 - p1, p, p2);
+ record_print(r);
+     }
+@@ -947,7 +947,7 @@ int fscheck_files(volume* vol)
+
+     if (!btree_check_nodealloc(catalog, catalog->head.leaf_head))
+     {
+- printf("leaf_head %ld not allocated in node Map\n",
++ printf("leaf_head %d not allocated in node Map\n",
+ catalog->head.leaf_head);
+ result |= FSCK_FSCORR; /* Maybe we can correct that one time */
+     }
Index: patches/patch-libhfsp_src_fscheck_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-libhfsp_src_fscheck_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-libhfsp_src_fscheck_c
--- patches/patch-libhfsp_src_fscheck_c 6 Feb 2011 16:03:55 -0000 1.1
+++ patches/patch-libhfsp_src_fscheck_c 12 Feb 2021 05:29:54 -0000
@@ -1,7 +1,136 @@
 $OpenBSD: patch-libhfsp_src_fscheck_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
---- libhfsp/src/fscheck.c.orig Mon Mar 25 15:48:37 2002
-+++ libhfsp/src/fscheck.c Sat Jan 29 06:01:31 2011
-@@ -204,7 +204,8 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
+
+Fix -fno-common by moving fsck_data, from Gentoo
+https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/hfsplusutils/files/hfsplusutils-1.0.4-fno-common-gcc10.patch
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Fix hpfsck of newer HFS+ volumes: set vol->maxblocks when volume is
+without HFS wrapper, so we can find the backup volume header.
+
+Other changes unbreak the build.
+
+Index: libhfsp/src/fscheck.c
+--- libhfsp/src/fscheck.c.orig
++++ libhfsp/src/fscheck.c
+@@ -47,19 +47,21 @@
+ # include "os.h"
+ # include "swab.h"
+
++struct fsck_data_t fsck_data;
++
+ /* Dump all raw fork information to stdout */
+ void print_fork(hfsp_fork_raw* f)
+ {
+     int    i;
+     hfsp_extent*    e;
+     printf("total_size          : %#LX\n"  , f->total_size);
+-    printf("clump_size          : %#lX\n"  , f->clump_size);
+-    printf("total_blocks        : %#lX\n"  , f->total_blocks);
++    printf("clump_size          : %#X\n"   , f->clump_size);
++    printf("total_blocks        : %#X\n"   , f->total_blocks);
+     printf("extents             : ");
+     for (i=0; i < 8; i++)
+     {
+ e = &f->extents[i];
+- printf("(%#lX+%#lX) " , e->start_block,e->block_count);
++ printf("(%#X+%#X) " , e->start_block,e->block_count);
+     }
+     printf("\n");
+ }
+@@ -78,24 +80,24 @@ void volume_print(hfsp_vh* vh)
+     printf("signature       : %c%c\n" , ((char*)&vh->signature)[0],
+ ((char*)&vh->signature)[1]);
+     printf("version         : %u\n"  , vh->version);
+-    printf("attributes      : %#lX\n"  , vh->attributes);
++    printf("attributes      : %#X\n"  , vh->attributes);
+     printf("last_mount_vers : "); print_sig(vh->last_mount_vers);
+-    printf("\nreserved        : %lu\n"  , vh->reserved);
++    printf("\nreserved        : %u\n"  , vh->reserved);
+ /* Hmm this is in local, apple time ... */
+     printf("create_date     : %s"  , get_atime(vh->create_date));
+     printf("modify_date     : %s"  , get_atime(vh->modify_date));
+     printf("backup_date     : %s"  , get_atime(vh->backup_date));
+     printf("checked_date    : %s"  , get_atime(vh->checked_date));
+-    printf("file_count      : %lu\n"  , vh->file_count);
+-    printf("folder_count    : %lu\n"  , vh->folder_count);
+-    printf("blocksize       : %lX\n"  , vh->blocksize);
+-    printf("total_blocks    : %lu\n"  , vh->total_blocks);
+-    printf("free_blocks     : %lu\n"  , vh->free_blocks);
+-    printf("next_alloc      : %lu\n"  , vh->next_alloc);
+-    printf("rsrc_clump_sz   : %lu\n"  , vh->rsrc_clump_sz);
+-    printf("data_clump_sz   : %lu\n"  , vh->data_clump_sz);
+-    printf("next_cnid       : %lu\n"  , vh->next_cnid);
+-    printf("write_count     : %lu\n"  , vh->write_count);
++    printf("file_count      : %u\n"  , vh->file_count);
++    printf("folder_count    : %u\n"  , vh->folder_count);
++    printf("blocksize       : %X\n"  , vh->blocksize);
++    printf("total_blocks    : %u\n"  , vh->total_blocks);
++    printf("free_blocks     : %u\n"  , vh->free_blocks);
++    printf("next_alloc      : %u\n"  , vh->next_alloc);
++    printf("rsrc_clump_sz   : %u\n"  , vh->rsrc_clump_sz);
++    printf("data_clump_sz   : %u\n"  , vh->data_clump_sz);
++    printf("next_cnid       : %u\n"  , vh->next_cnid);
++    printf("write_count     : %u\n"  , vh->write_count);
+     printf("encodings_bmp   : %#LX\n"  , vh->encodings_bmp);
+     /* vv->finder_info, p, 32); */
+     printf("                  Allocation file\n");
+@@ -119,7 +121,7 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
+     // vh->signature // already checked in read
+     // vh->version // Current is 4 but I wont check that
+     if (attributes & HFSPLUS_VOL_RESERVED1)
+- printf("Reserved attribute in use: %lX\n",
++ printf("Reserved attribute in use: %X\n",
+    vh->attributes & HFSPLUS_VOL_RESERVED1);
+     if (! (attributes & HFSPLUS_VOL_UNMNT))
+ printf("Volume was not cleanly unmounted\n");
+@@ -130,12 +132,12 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
+     if (attributes & HFSPLUS_VOL_INCNSTNT)
+ printf("Volume is inconsistent\n");
+     if (attributes & HFSPLUS_VOL_RESERVED2)
+- printf("Reserved attribute in use: %lX\n",
++ printf("Reserved attribute in use: %X\n",
+    vh->attributes & HFSPLUS_VOL_RESERVED2);
+     if (fsck_data.verbose && (attributes & HFSPLUS_VOL_SOFTLOCK))
+ printf("Volume is soft locked");
+     if (attributes & HFSPLUS_VOL_RESERVED3)
+- printf("Reserved attribute in use: %lX\n",
++ printf("Reserved attribute in use: %X\n",
+    vh->attributes & HFSPLUS_VOL_RESERVED3);
+     switch (vh->last_mount_vers)
+     {
+@@ -169,25 +171,25 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
+     // vh->folder_count // To be checked later
+     if (0 != (vh->blocksize % HFSP_BLOCKSZ)) // must be multiple of BLKSZ
+     {
+- printf("Invalid Blocksize %lX\n", vh->blocksize);
++ printf("Invalid Blocksize %X\n", vh->blocksize);
+ result = FSCK_ERR; // Wont try to correct that, yet.
+     }
+     {
+ UInt64 totalbytes    = vh->total_blocks * vh->blocksize;
+ UInt64 expectedbytes = vol->maxblocks << vol->blksize_bits;
+ if (totalbytes > expectedbytes)
+-    printf("\nInvalid total blocks %lX, expected %lX",
++    printf("\nInvalid total blocks %X, expected %X",
+ vh->total_blocks, (UInt32)(expectedbytes / vh->blocksize));
+     }
+     if (vh->free_blocks > vh->total_blocks)
+- printf("More free blocks (%lX) than total (%lX) ?\n",
++ printf("More free blocks (%X) than total (%X) ?\n",
+    vh->free_blocks, vh->total_blocks);
+ // Check more later
+     // vh->next_alloc // to be checked later
+     // vh->rsrc_clump_sz  // no check needed, is a hint only
+     // vh->data_clump_sz  // no check needed, is a hint only
+     if (vh->next_cnid <= HFSP_MIN_CNID) // wil hopefully be fixed later
+- printf("Invalid next_cnid: %ld\n", vh->next_cnid);
++ printf("Invalid next_cnid: %d\n", vh->next_cnid);
+ // Check more later
+     // vh->write_count    // no check possible
+     // vh->encodings_bmp    // no check needed, is a hint only
+@@ -204,7 +206,8 @@ static int fscheck_volume_header(volume * vol, hfsp_vh
   */
  static int fscheck_volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
  {
@@ -11,7 +140,7 @@ $OpenBSD: patch-libhfsp_src_fscheck_c,v
      {
  printf("Unexpected Volume signature '%2s' expected 'H+'\n",
  (char*) &vh->signature);
-@@ -230,7 +231,7 @@ static int fscheck_volume_readbuf(volume * vol, hfsp_v
+@@ -230,7 +233,7 @@ static int fscheck_volume_readbuf(volume * vol, hfsp_v
      vh->write_count = bswabU32_inc(p);
      vh->encodings_bmp = bswabU64_inc(p);
      memcpy(vh->finder_info, p, 32);
@@ -20,7 +149,7 @@ $OpenBSD: patch-libhfsp_src_fscheck_c,v
      p = volume_readfork(p, &vh->alloc_file );
      p = volume_readfork(p, &vh->ext_file   );
      p = volume_readfork(p, &vh->cat_file   );
-@@ -277,12 +278,12 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
+@@ -277,12 +280,12 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
     printf("Volume is wrapped in HFS volume "
    " (use hfsck to check this)\n");
 
@@ -36,3 +165,43 @@ $OpenBSD: patch-libhfsp_src_fscheck_c,v
  signature = bswabU16_inc(p); /* offset 0x7C, drEmbedSigWord */
  if (signature != HFSP_VOLHEAD_SIG)
     HFSP_ERROR(-1, "This looks like a normal HFS volume");
+@@ -291,7 +294,7 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
+ sect_per_block =  (drAlBlkSiz / HFSP_BLOCKSZ);  
+ if ((sect_per_block * HFSP_BLOCKSZ) != drAlBlkSiz)
+ {
+-    printf("HFS Blocksize %lX is not multiple of %X\n",
++    printf("HFS Blocksize %X is not multiple of %X\n",
+    drAlBlkSiz, HFSP_BLOCKSZ);
+    return FSCK_ERR; // Cant help it (for now)
+ }
+@@ -301,7 +304,7 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
+    << HFS_BLOCKSZ_BITS;
+ /* Now we can try to read the embedded HFS+ volume header */
+ if (fsck_data.verbose)
+-    printf("Embedded HFS+ volume at 0x%LX (0x%lX) of 0x%X sized Blocks\n",
++    printf("Embedded HFS+ volume at 0x%LX (0x%X) of 0x%X sized Blocks\n",
+    os_offset, vol->maxblocks, HFSP_BLOCKSZ);
+ return fscheck_volume_read(vol,vh,2);
+     }
+@@ -310,7 +313,11 @@ static int fscheck_read_wrapper(volume * vol, hfsp_vh*
+ if (fsck_data.verbose)
+    printf("This HFS+ volume is not wrapped.\n");
+ p = buf; // Restore to begin of block
+- return fscheck_volume_readbuf(vol, vh, p);
++ if (fscheck_volume_readbuf(vol, vh, p))
++    return -1;
++ // Need maxblocks in sectors
++ vol->maxblocks = vh->total_blocks * (vh->blocksize / HFSP_BLOCKSZ);
++ return 0;
+     } else
+ HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found");
+    
+@@ -339,7 +346,7 @@ int check_forkalloc(volume* vol, hfsp_fork_raw* fork)
+ {
+    if (!volume_allocated(vol, block))
+    {
+- printf("Warning block %lX not marked as allocated\n",block);
++ printf("Warning block %X not marked as allocated\n",block);
+ errcount++;
+    }
+    count --;
Index: patches/patch-libhfsp_src_fscheck_h
===================================================================
RCS file: patches/patch-libhfsp_src_fscheck_h
diff -N patches/patch-libhfsp_src_fscheck_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libhfsp_src_fscheck_h 12 Feb 2021 05:29:54 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+Fix -fno-common by moving fsck_data, from Gentoo
+https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/hfsplusutils/files/hfsplusutils-1.0.4-fno-common-gcc10.patch
+
+Index: libhfsp/src/fscheck.h
+--- libhfsp/src/fscheck.h.orig
++++ libhfsp/src/fscheck.h
+@@ -100,10 +100,11 @@ int fscheck_btree(btree *bt);
+ int fscheck_files(volume* vol);
+
+ /** global data used during fsck */
+-struct {
++struct fsck_data_t {
+     UInt32  maxCnid;
+     UInt32  macNow; // current date in mac-offset
+     int    verbose;
+     int    ignoreErr;
+-} fsck_data;
++};
+
++extern struct fsck_data_t fsck_data;
Index: patches/patch-libhfsp_src_record_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-libhfsp_src_record_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-libhfsp_src_record_c
--- patches/patch-libhfsp_src_record_c 6 Feb 2011 16:03:55 -0000 1.1
+++ patches/patch-libhfsp_src_record_c 12 Feb 2021 05:29:54 -0000
@@ -1,6 +1,13 @@
 $OpenBSD: patch-libhfsp_src_record_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
---- libhfsp/src/record.c.orig Sun Mar 17 17:20:01 2002
-+++ libhfsp/src/record.c Sat Jan 29 06:22:42 2011
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Other changes unbreak the build.
+
+Index: libhfsp/src/record.c
+--- libhfsp/src/record.c.orig
++++ libhfsp/src/record.c
 @@ -32,6 +32,8 @@
 
  #include <errno.h>
@@ -22,3 +29,12 @@ $OpenBSD: patch-libhfsp_src_record_c,v 1
      switch (type)
      {
  case HFSP_FOLDER:
+@@ -1269,7 +1271,7 @@ int record_insert(record* r)
+     len = p - buf;
+     if (len > bt->max_rec_size) // Emergency bail out, sorry
+     {
+- fprintf(stderr,"Unexpected Buffer overflow in record_insert %d > %d",
++ fprintf(stderr,"Unexpected Buffer overflow in record_insert %d > %zu",
+ len, sizeof(bt->max_rec_size));
+ exit(-1);
+     }
Index: patches/patch-libhfsp_src_volume_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-libhfsp_src_volume_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-libhfsp_src_volume_c
--- patches/patch-libhfsp_src_volume_c 6 Feb 2011 16:03:55 -0000 1.1
+++ patches/patch-libhfsp_src_volume_c 12 Feb 2021 05:29:54 -0000
@@ -1,6 +1,13 @@
 $OpenBSD: patch-libhfsp_src_volume_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
---- libhfsp/src/volume.c.orig Tue Mar 26 18:00:29 2002
-+++ libhfsp/src/volume.c Sat Jan 29 06:01:51 2011
+
+Fix hpmount of newer HFS+ volumes: set vol->maxblocks when volume is
+without HFS wrapper, so we can find the backup volume header.
+
+Other changes unbreak the build.
+
+Index: libhfsp/src/volume.c
+--- libhfsp/src/volume.c.orig
++++ libhfsp/src/volume.c
 @@ -323,7 +323,8 @@ void* volume_writefork(void *p, hfsp_fork_raw* f)
   */
  static int volume_readbuf(hfsp_vh* vh, void* p)
@@ -45,3 +52,16 @@ $OpenBSD: patch-libhfsp_src_volume_c,v 1
  signature = bswabU16_inc(p); /* offset 0x7C, drEmbedSigWord */
  if (signature != HFSP_VOLHEAD_SIG)
     HFSP_ERROR(-1, "This looks like a normal HFS volume");
+@@ -439,7 +440,11 @@ static int volume_read_wrapper(volume * vol, hfsp_vh*
+     else if (signature == HFSP_VOLHEAD_SIG) /* Native HFS+ volume */
+     {
+ p = buf; // Restore to begin of block
+- return volume_readbuf(vh, p);
++ if (volume_readbuf(vh, p))
++    return -1;
++ // Need maxblocks in sectors
++ vol->maxblocks = vh->total_blocks * (vh->blocksize / HFSP_BLOCKSZ);
++ return 0;
+     } else
+ HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found");
+    
Index: patches/patch-src_copyout_c
===================================================================
RCS file: patches/patch-src_copyout_c
diff -N patches/patch-src_copyout_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_copyout_c 12 Feb 2021 05:29:54 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix passing &size to int *lenptr
+
+Index: src/copyout.c
+--- src/copyout.c.orig
++++ src/copyout.c
+@@ -365,7 +365,7 @@ int do_text(volume* vol, hfsp_fork_raw *fork, UInt8 fo
+     {
+         UInt32  block   = blockiter_curr(&iter);
+         int     result  = volume_readinbuf(vol, buf, block);
+-        size_t size    = total > blksize ? blksize : total;
++        int     size    = total > blksize ? blksize : total;
+ size_t bytes;
+ char *latin1, *ptr, *ptrend;
+         if (result)
Index: patches/patch-src_hpcache_c
===================================================================
RCS file: patches/patch-src_hpcache_c
diff -N patches/patch-src_hpcache_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_hpcache_c 12 Feb 2021 05:29:54 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Index: src/hpcache.c
+--- src/hpcache.c.orig
++++ src/hpcache.c
+@@ -102,7 +102,7 @@ static int hpcache_read()
+ return -1;
+     }
+
+-    params = fscanf(fd, "%255[^:]:%lu:%u",
++    params = fscanf(fd, "%255[^:]:%u:%u",
+ volume_cache.vname, &volume_cache.cnid, &volume_cache.partition);
+     if (params < 2)
+     {
+@@ -128,7 +128,7 @@ static int hpcache_write()
+ return -1;
+     }
+
+-    fprintf(fd, "%s:%lu:%u",
++    fprintf(fd, "%s:%u:%u",
+    volume_cache.vname, volume_cache.cnid, volume_cache.partition);
+
+     return 0;
Index: patches/patch-src_hpls_c
===================================================================
RCS file: /cvs/ports/misc/hfsplus/patches/patch-src_hpls_c,v
retrieving revision 1.3
diff -u -p -r1.3 patch-src_hpls_c
--- patches/patch-src_hpls_c 21 Nov 2007 14:30:36 -0000 1.3
+++ patches/patch-src_hpls_c 12 Feb 2021 05:29:54 -0000
@@ -1,7 +1,23 @@
 $OpenBSD: patch-src_hpls_c,v 1.3 2007/11/21 14:30:36 ajacoutot Exp $
---- src/hpls.c.orig Sun Mar 17 18:20:39 2002
-+++ src/hpls.c Wed Nov 21 13:55:02 2007
-@@ -417,7 +417,7 @@ void showmisc(record *ent, int flags)
+
+Fix LP64_ARCHS: change UInt32 and like types from long to int, so each
+type has exactly 32 bits; change printf()s to match.
+
+Index: src/hpls.c
+--- src/hpls.c.orig
++++ src/hpls.c
+@@ -408,16 +408,16 @@ void showmisc(record *ent, int flags)
+     if (flags & HPLS_CATIDS)
+     {
+         if (ent->record.type < HFSP_FOLDER_THREAD)
+-    printf("%7lu ", ent->record.u.file.id);
++    printf("%7u ", ent->record.u.file.id);
+ else
+-    printf("%7lu ", ent->record.u.thread.parentID);
++    printf("%7u ", ent->record.u.thread.parentID);
+     }
+     if (flags & HPLS_SIZE &&
+ ent->record.type == HFSP_FILE)
      {
  size = ent->record.u.file.data_fork.total_size +
        ent->record.u.file.res_fork.total_size;
@@ -10,6 +26,15 @@ $OpenBSD: patch-src_hpls_c,v 1.3 2007/11
      }
  }
 
+@@ -476,7 +476,7 @@ void show_long(int sz, queueent *ents, char **strs,
+         if (ent->record.type == HFSP_FOLDER)
+ {
+    hfsp_cat_folder* f = &ent->record.u.folder;
+-    printf("d%c %9lu item%c               %s %s\n",
++    printf("d%c %9u item%c               %s %s\n",
+       f->user_info.frFlags & HFS_FNDR_ISINVISIBLE ? 'i' : ' ',
+       f->valence, f->valence == 1 ? ' ' : 's',
+       timebuf + 4, strs[i]);
 @@ -484,7 +484,7 @@ void show_long(int sz, queueent *ents, char **strs,
  else if (ent->record.type == HFSP_FILE)
  {

Reply | Threaded
Open this post in threaded view
|

Re: misc/hfsplus -fno-common

Thaison Nguyen
>
> Here's the diff that I want to commit.  Thaison, does this work with
> your HFS+ drive?  OpenBSD devs, is this ok to commit?
>

Yes, I was able to successfully mount the USB stick and copy a text file
from it. Thanks

Reply | Threaded
Open this post in threaded view
|

Re: misc/hfsplus -fno-common

Theo Buehler-3
In reply to this post by George Koehler-2
On Sat, Feb 13, 2021 at 10:15:00PM -0500, George Koehler wrote:

> On Tue, 9 Feb 2021 23:21:08 -0500
> George Koehler <[hidden email]> wrote:
>
> > On Sat, 6 Feb 2021 11:53:22 +0100
> > Thaison Nguyen <[hidden email]> wrote:
> >
> > > obsd# hpmount -r /dev/rsd1i
> > > hpmount: /dev/rsd1i: This is not a HFS+ volume (Unknown error: -1)
>
> Here's the diff that I want to commit.  Thaison, does this work with
> your HFS+ drive?  OpenBSD devs, is this ok to commit?

I no longer have hardware to test this, but the diff looks good to me.

ok tb