diff options
author | obache <obache@pkgsrc.org> | 2011-01-08 13:00:13 +0000 |
---|---|---|
committer | obache <obache@pkgsrc.org> | 2011-01-08 13:00:13 +0000 |
commit | 2bf1106ef2172fd31c2a81e1b1af6fbfd882e27f (patch) | |
tree | 0c7a9b5d3661995e73ad604ac64a236ecaf8840a /sysutils/hal/patches/patch-ak | |
parent | 2156ddc7783c8844cadc7ce820b09df49ded2cc4 (diff) | |
download | pkgsrc-2bf1106ef2172fd31c2a81e1b1af6fbfd882e27f.tar.gz |
Bring back DragonFly BSD support.
Based on PR#44338 from Rumko, also fixes PLIST.FreeBSD and self-tests by me.
Diffstat (limited to 'sysutils/hal/patches/patch-ak')
-rw-r--r-- | sysutils/hal/patches/patch-ak | 96 |
1 files changed, 81 insertions, 15 deletions
diff --git a/sysutils/hal/patches/patch-ak b/sysutils/hal/patches/patch-ak index 227b9662590..8bdd6c28bc7 100644 --- a/sysutils/hal/patches/patch-ak +++ b/sysutils/hal/patches/patch-ak @@ -1,43 +1,109 @@ -$NetBSD: patch-ak,v 1.2 2010/12/26 20:59:31 markd Exp $ +$NetBSD: patch-ak,v 1.3 2011/01/08 13:00:13 obache Exp $ --- hald/freebsd/probing/probe-volume.c.orig 2009-09-17 13:45:09.000000000 +0000 +++ hald/freebsd/probing/probe-volume.c -@@ -33,7 +33,9 @@ +@@ -33,7 +33,11 @@ #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> -+#ifndef __DragonFly__ ++#ifdef __DragonFly__ ++#include <sys/diskslice.h> ++#else #include <sys/disk.h> +#endif #include <sys/cdio.h> #include <sys/param.h> #include <sys/mount.h> -@@ -371,6 +373,7 @@ main (int argc, char **argv) +@@ -41,7 +45,11 @@ + #include <ufs/ufs/ufsmount.h> + #include <ufs/ufs/dinode.h> + #include <ufs/ffs/fs.h> ++#ifdef __DragonFly__ ++#include <ufs/ufs/ufs_types.h> ++#else + #include <libufs.h> ++#endif + #include <isofs/cd9660/iso.h> + #include <glib.h> + #include <libvolume_id.h> +@@ -332,6 +340,9 @@ main (int argc, char **argv) + gboolean is_blank = FALSE; + const char *usage; + char *label; ++#ifdef __DragonFly__ ++ struct partinfo device_info; ++#endif + unsigned int sector_size = 0; + off_t media_size = 0; + +@@ -371,7 +382,12 @@ main (int argc, char **argv) is_blank = (! has_audio && ! has_data); } -+#ifndef __DragonFly__ ++#ifdef __DragonFly__ ++ ioctl(fd, DIOCGPART, &device_info); ++ media_size = device_info.media_size; ++#else ioctl(fd, DIOCGMEDIASIZE, &media_size); ++#endif /* -@@ -396,6 +399,7 @@ main (int argc, char **argv) + * We only check for filesystems if the volume has no children, +@@ -563,16 +579,35 @@ main (int argc, char **argv) + + if (vid && ! strcmp (vid->type, "ufs")) + { ++#ifdef __DragonFly__ ++ struct fs fs; ++ int rfd; ++ ssize_t nr; ++ ++ if ((rfd = open(device_file, O_RDONLY)) >= 0) { ++ lseek(rfd, (off_t) SBOFF, SEEK_SET); ++ ++ nr = read(rfd, &fs, (size_t) SBSIZE); ++ close(rfd); ++ } ++ ++ if (nr == (ssize_t) SBSIZE) ++#else + struct uufsd ufsdisk; + + if (ufs_disk_fillout(&ufsdisk, device_file) == 0) ++#endif + { + char ufsid[64]; + char **ufs_devs = NULL; + int num_udis; + int i; + ++#ifdef __DragonFly__ ++ snprintf(ufsid, sizeof(ufsid), "%08x%08x", fs.fs_id[0], fs.fs_id[1]); ++#else + snprintf(ufsid, sizeof(ufsid), "%08x%08x", ufsdisk.d_fs.fs_id[0], ufsdisk.d_fs.fs_id[1]); ++#endif + libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.freebsd.ufsid", ufsid, &hfp_error); + ufs_devs = libhal_manager_find_device_string_match(hfp_ctx, + "volume.freebsd.ufsid", +@@ -597,7 +632,9 @@ main (int argc, char **argv) } + if (ufs_devs) + libhal_free_string_array(ufs_devs); ++#ifndef __DragonFly__ + ufs_disk_close(&ufsdisk); ++#endif } } -+#endif - if (! has_children && ! is_swap && ! has_audio && ! has_data && ! is_blank) - goto end; -@@ -628,10 +632,12 @@ main (int argc, char **argv) +@@ -628,7 +665,11 @@ main (int argc, char **argv) libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.uuid", vid ? vid->uuid : "", &hfp_error); -+#ifndef __DragonFly__ ++#ifdef __DragonFly__ ++ sector_size = device_info.media_blksize; ++#else ioctl(fd, DIOCGSECTORSIZE, §or_size); ++#endif if (sector_size != 0) libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "volume.block_size", sector_size, &hfp_error); -+#endif - if (media_size != 0) - libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "volume.size", media_size, &hfp_error); - if (sector_size != 0 && media_size != 0) |