Skip to content

Commit 092905a

Browse files
committed
patch: patching xfsprogs to source default config files
1 parent b6a8be4 commit 092905a

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From b20a9a213e1f4901072f559e3aef4797b5955c59 Mon Sep 17 00:00:00 2001
2+
From: Sparks Song <[email protected]>
3+
Date: Wed, 4 Dec 2024 23:47:28 +0000
4+
Subject: [PATCH] mkfs: source defaults from config file to make nrext64
5+
default off on multiple kernel versions
6+
7+
---
8+
mkfs/xfs_mkfs.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-
9+
1 file changed, 50 insertions(+), 1 deletion(-)
10+
11+
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
12+
index 6d2469c..1f6f643 100644
13+
--- a/mkfs/xfs_mkfs.c
14+
+++ b/mkfs/xfs_mkfs.c
15+
@@ -39,6 +39,9 @@
16+
*/
17+
#define WHACK_SIZE (128 * 1024)
18+
19+
+/* Default path for the mkfs.xfs configuration file */
20+
+#define DEFAULT_CONFIG_PATH "/usr/share/xfs/mkfs.xfs.conf"
21+
+
22+
/*
23+
* XXX: The configured block and sector sizes are defined as global variables so
24+
* that they don't need to be passed to getnum/cvtnum().
25+
@@ -4271,6 +4274,44 @@ cfgfile_parse(
26+
cli->cfgfile);
27+
}
28+
29+
+
30+
+/* This function is similar to cfgfile_parse() and specifically parses
31+
+ * default config files. It doesn’t exit on failure.
32+
+ */
33+
+static void
34+
+cfgfile_parse_default(
35+
+ struct cli_params *cli)
36+
+{
37+
+ int error;
38+
+
39+
+ if (!cli->cfgfile)
40+
+ return;
41+
+
42+
+ error = ini_parse(cli->cfgfile, cfgfile_parse_ini, cli);
43+
+ if (error) {
44+
+ if (error > 0) {
45+
+ fprintf(stderr,
46+
+ _("%s: Unrecognised input on line %d. Aborting.\n"),
47+
+ cli->cfgfile, error);
48+
+ } else if (error == -1) {
49+
+ fprintf(stderr,
50+
+ _("Unable to open default config file %s. Aborting.\n"),
51+
+ cli->cfgfile);
52+
+ } else if (error == -2) {
53+
+ fprintf(stderr,
54+
+ _("Memory allocation failure parsing %s. Aborting.\n"),
55+
+ cli->cfgfile);
56+
+ } else {
57+
+ fprintf(stderr,
58+
+ _("Unknown error %d opening default config file %s. Aborting.\n"),
59+
+ error, cli->cfgfile);
60+
+ }
61+
+ } else {
62+
+ printf(_("Parameters parsed from default config file %s successfully\n"),
63+
+ cli->cfgfile);
64+
+ }
65+
+}
66+
+
67+
int
68+
main(
69+
int argc,
70+
@@ -4428,7 +4469,15 @@ main(
71+
* the options from this file parsed, we can then proceed with parameter
72+
* and bounds checking and making the filesystem.
73+
*/
74+
- cfgfile_parse(&cli);
75+
+
76+
+ if (cli.cfgfile == NULL) {
77+
+ /* No user config file specified, try default config */
78+
+ cli.cfgfile = DEFAULT_CONFIG_PATH;
79+
+ cfgfile_parse_default(&cli);
80+
+ } else {
81+
+ /* User specified their own config file, use that */
82+
+ cfgfile_parse(&cli);
83+
+ }
84+
85+
protostring = setup_proto(cli.protofile);
86+
87+
--
88+
2.47.0
89+

packages/xfsprogs/xfsprogs.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ License: GPL-2.0-only AND LGPL-2.1-only
66
URL: https://xfs.wiki.kernel.org
77
Source0: http://kernel.org/pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-%{version}.tar.xz
88

9+
Patch1000: 0001-mkfs-source-defaults-from-config-file.patch
10+
911
BuildRequires: %{_cross_os}glibc-devel
1012
BuildRequires: %{_cross_os}libuuid-devel
1113
BuildRequires: %{_cross_os}libinih-devel
@@ -14,6 +16,9 @@ BuildRequires: %{_cross_os}libblkid-devel
1416

1517
Requires: %{_cross_os}liburcu
1618
Requires: %{_cross_os}libinih
19+
Requires: (%{_cross_os}kernel-5.10-mkfs-confs if %{_cross_os}kernel-5.10)
20+
Requires: (%{_cross_os}kernel-5.15-mkfs-confs if %{_cross_os}kernel-5.15)
21+
Requires: (%{_cross_os}kernel-6.1-mkfs-confs if %{_cross_os}kernel-6.1)
1722

1823
%description
1924
%{summary}.
@@ -26,7 +31,7 @@ Requires: %{name}
2631
%{summary}.
2732

2833
%prep
29-
%autosetup -n xfsprogs-%{version}
34+
%autosetup -n xfsprogs-%{version} -p1
3035

3136
%build
3237
%cross_configure \

0 commit comments

Comments
 (0)