| ... |
... |
@@ -23,16 +23,64 @@ diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs |
|
23
|
23
|
#include <sys/vmmeter.h>
|
|
24
|
24
|
#endif
|
|
25
|
25
|
|
|
26
|
|
-@@ -571,8 +571,10 @@
|
|
27
|
|
- /* Adjust free blocks to reflect everything we have allocated. */
|
|
|
26
|
+@@ -572,7 +572,18 @@ InitVH(hfsparams_t *defaults, UInt64 sec
|
|
28
|
27
|
hp->freeBlocks -= blocksUsed;
|
|
29
|
28
|
|
|
30
|
|
-- /* Generate and write UUID for the HFS+ disk */
|
|
|
29
|
+ /* Generate and write UUID for the HFS+ disk */
|
|
31
|
30
|
- GenerateVolumeUUID(&newVolumeUUID);
|
|
32
|
|
-+ /* Use a deterministic UUID for reproducibility */
|
|
33
|
|
-+ memset(&newVolumeUUID, 0, sizeof(newVolumeUUID));
|
|
34
|
|
-+ strncpy(&newVolumeUUID, defaults->volumeName, sizeof(newVolumeUUID));
|
|
35
|
|
-+
|
|
|
31
|
++ /*
|
|
|
32
|
++ * createDate is a 32-bit integer, so spread its value around with
|
|
|
33
|
++ * https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64
|
|
|
34
|
++ */
|
|
|
35
|
++ {
|
|
|
36
|
++ uint64_t z = defaults->createDate + 0x9e3779b97f4a7c15;
|
|
|
37
|
++ z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
|
|
|
38
|
++ z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
|
|
|
39
|
++ z = z ^ (z >> 31);
|
|
|
40
|
++ newVolumeUUID.value[0] = (uint32_t)(z >> 32);
|
|
|
41
|
++ newVolumeUUID.value[1] = (uint32_t)z;
|
|
|
42
|
++ }
|
|
36
|
43
|
finderInfoUUIDPtr = (VolumeUUID *)(&hp->finderInfo[24]);
|
|
37
|
44
|
finderInfoUUIDPtr->v.high = OSSwapHostToBigInt32(newVolumeUUID.v.high);
|
|
38
|
45
|
finderInfoUUIDPtr->v.low = OSSwapHostToBigInt32(newVolumeUUID.v.low);
|
|
|
46
|
+diff '--color=auto' -rupN diskdev_cmds-540.1.linux3.orig/newfs_hfs.tproj/newfs_hfs.c diskdev_cmds-540.1.linux3/newfs_hfs.tproj/newfs_hfs.c
|
|
|
47
|
+--- diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/newfs_hfs.c 2026-11-18 09:58:18.436848140 +0100
|
|
|
48
|
++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/newfs_hfs.c 2026-11-18 10:21:37.246871550 +0100
|
|
|
49
|
+@@ -191,7 +191,7 @@ main(argc, argv)
|
|
|
50
|
+ progname = *argv;
|
|
|
51
|
+
|
|
|
52
|
+
|
|
|
53
|
+- while ((ch = getopt(argc, argv, "G:J:D:M:N:PU:hsb:c:i:n:v:")) != EOF)
|
|
|
54
|
++ while ((ch = getopt(argc, argv, "G:J:D:M:N:PU:hsb:c:i:n:v:t:")) != EOF)
|
|
|
55
|
+ switch (ch) {
|
|
|
56
|
+ case 'G':
|
|
|
57
|
+ gGroupID = a_gid(optarg);
|
|
|
58
|
+@@ -286,6 +286,10 @@ main(argc, argv)
|
|
|
59
|
+ #endif
|
|
|
60
|
+ break;
|
|
|
61
|
+
|
|
|
62
|
++ case 't':
|
|
|
63
|
++ createtime = (time_t)strtoull(optarg, NULL, 10);
|
|
|
64
|
++ break;
|
|
|
65
|
++
|
|
|
66
|
+ case '?':
|
|
|
67
|
+ default:
|
|
|
68
|
+ usage();
|
|
|
69
|
+@@ -763,7 +767,8 @@ hfs_newfs(char *device)
|
|
|
70
|
+ #endif
|
|
|
71
|
+
|
|
|
72
|
+ dip.sectorOffset = 0;
|
|
|
73
|
+- time(&createtime);
|
|
|
74
|
++ if (!createtime)
|
|
|
75
|
++ time(&createtime);
|
|
|
76
|
+
|
|
|
77
|
+ /* Check to see if the disk is too big */
|
|
|
78
|
+ u_int64_t secsize = (u_int64_t) dip.sectorSize;
|
|
|
79
|
+@@ -1270,6 +1275,7 @@ void usage()
|
|
|
80
|
+ fprintf(stderr, "\t\tc=size (catalog b-tree)\n");
|
|
|
81
|
+ fprintf(stderr, "\t\ta=size (attributes b-tree)\n");
|
|
|
82
|
+ fprintf(stderr, "\t-v volume name (in ascii or UTF-8)\n");
|
|
|
83
|
++ fprintf(stderr, "\t-t creation time (UNIX timestamp)\n");
|
|
|
84
|
+
|
|
|
85
|
+ fprintf(stderr, " examples:\n");
|
|
|
86
|
+ fprintf(stderr, "\t%s -v Untitled /dev/rdisk0s7 \n", progname); |