1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

partition: fix build with newer linux/btrfs.h uapi header

linux/btrfs.h needs  to be included after sys/mount.h, as since [0]
linux/btrfs.h includes linux/fs.h causing build errors:

```
In file included from /usr/include/linux/fs.h:19,
                 from ../src/basic/linux/btrfs.h:29,
                 from ../src/partition/growfs.c:6:
/usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant
   35 |   MS_RDONLY = 1,                /* Mount read-only.  */
      |   ^~~~~~~~~
[1222/2169] Compiling C object systemd-creds.p/src_creds_creds.c.o
ninja: build stopped: subcommand failed.
```

See: https://github.com/systemd/systemd/issues/8507

[0] a28135303a

(cherry picked from commit ed614f17fc)
(cherry picked from commit 8f84df0da3)
This commit is contained in:
Frantisek Sumsal 2023-01-25 13:21:09 +01:00 committed by Luca Boccassi
parent 4bc291c1d4
commit 1fc632e151

View File

@ -3,12 +3,17 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/btrfs.h>
#include <linux/magic.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/vfs.h>
/* This needs to be included after sys/mount.h, as since [0] linux/btrfs.h
* includes linux/fs.h causing build errors
* See: https://github.com/systemd/systemd/issues/8507
* [0] https://github.com/torvalds/linux/commit/a28135303a669917002f569aecebd5758263e4aa
*/
#include <linux/btrfs.h>
#include "blockdev-util.h"
#include "btrfs-util.h"