Skip to contentSkip to conversation

ubifs-utils: ubifs.h: Include <fcntl.h>

PATCH Superseded Fabio Estevam 2 participants 8 messages Feb 18, 2025 Memory technology devices (MTD)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 ubifs-utils: ubifs.h: Include <fcntl.h>

Include the <fcntl.h> header file to fix the following error when building with musl:

| In file included from ../git/ubifs-utils/common/compr.c:42:
| ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|   313 |         loff_t ui_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1341 |         loff_t i_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1342 |         loff_t d_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1899 |                              int deletion, loff_t new_size);
|       |                                            ^~~~~~
|       |                                            off_t
| make: *** [Makefile:4878: ubifs-utils/common/mkfs_ubifs-compr.o] Error 1

---
Changes since v1:
- None.

 ubifs-utils/libubifs/ubifs.h | 1 +
 1 file changed, 1 insertion(+)
ubifs-utils/libubifs/ubifs.h +1 -0
index 0908a2289208..1c7bc7bd0c80 100644
@@ -11,6 +11,7 @@
 #ifndef __UBIFS_H__
 #define __UBIFS_H__
 
+#include <fcntl.h>
 #include <string.h>
 
 #include "linux_types.h"
Signature · 6 lines
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw

PATCH v2 2/4 ubifs-utils: journal: Include <sys/stat.h>

Include the <sys/stat.h> header file to fix the following error when building with musl:

| ../git/ubifs-utils/libubifs/journal.c: In function 'ubifs_get_dent_type':
| ../git/ubifs-utils/libubifs/journal.c:414:24: error: 'S_IFMT' undeclared (first use in this function)
|   414 |         switch (mode & S_IFMT) {
|       |                        ^~~~~~
| ../git/ubifs-utils/libubifs/journal.c:414:24: note: each undeclared identifier is reported only once for each function it appears in
| ../git/ubifs-utils/libubifs/journal.c:415:14: error: 'S_IFREG' undeclared (first use in this function)
|   415 |         case S_IFREG:

---
Changes since v1:
- None.

 ubifs-utils/libubifs/journal.c | 1 +
 1 file changed, 1 insertion(+)
ubifs-utils/libubifs/journal.c +1 -0
index e78ea14f3e69..45d82fd54bdb 100644
@@ -46,6 +46,7 @@
  * all the nodes.
  */
 
+#include <sys/stat.h>
 #include "bitops.h"
 #include "kmem.h"
 #include "ubifs.h"
Signature · 6 lines
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v2 2/4
#2 lore raw

Re: [PATCH v2 mtd-utils 2/4] ubifs-utils: journal: Include <sys/stat.h>

Quoted 11 lines · Fabio Estevam

Include the <sys/stat.h> header file to fix the following error when building with musl:

| ../git/ubifs-utils/libubifs/journal.c: In function 'ubifs_get_dent_type':
| ../git/ubifs-utils/libubifs/journal.c:414:24: error: 'S_IFMT' undeclared (first use in this function)
|   414 |         switch (mode & S_IFMT) {
|       |                        ^~~~~~
| ../git/ubifs-utils/libubifs/journal.c:414:24: note: each undeclared identifier is reported only once for each function it appears in
| ../git/ubifs-utils/libubifs/journal.c:415:14: error: 'S_IFREG' undeclared (first use in this function)
|   415 |         case S_IFREG:
Quoted 8 lines

---
Changes since v1:
- None.

  ubifs-utils/libubifs/journal.c | 1 +
  1 file changed, 1 insertion(+)

ubifs-utils/libubifs/journal.c line 52

Quoted 13 lines
ubifs-utils/libubifs/journal.c +1 -0
index e78ea14f3e69..45d82fd54bdb 100644
@@ -46,6 +46,7 @@
   * all the nodes.
   */
 
+#include <sys/stat.h>
  #include "bitops.h"
  #include "kmem.h"
  #include "ubifs.h"

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#3 lore raw

PATCH v2 3/4 configure.ac: Add a check for execinfo and backtrace

In reply to Fabio Estevam

musl relies on an extenal execinfo library to provide backtrace functionality.

Add support for it.

| /work/festevam/oe/poky/build/tmp/work/core2-64-poky-linux-musl/mtd-utils/2.3.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux-musl/../../libexec/x86_64-poky-linux-musl/gcc/x86_64-poky-linux-musl/14.2.0/ld: ubifs-utils/libubifs/mkfs_ubifs-io.o: in function `dump_stack':
| /usr/src/debug/mtd-utils/2.3.0/ubifs-utils/common/defs.h:71:(.text+0x25): undefined reference to `backtrace'
....
| collect2: error: ld returned 1 exit status
| make: *** [Makefile:2959: mkfs.ubifs] Error 1

---
Changes since v1:
- None.

 configure.ac | 1 +
 1 file changed, 1 insertion(+)
configure.ac +1 -0
index 2a79ba820fc0..65afb245d89c 100644
@@ -238,6 +238,7 @@ if test "x$need_cmocka" = "xyes"; then
 	PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"])
 fi
 
+AC_CHECK_LIB([execinfo], [backtrace])
 AC_CHECK_HEADERS([execinfo.h])
 
 ##### produce summary on dependencies #####
Signature · 6 lines
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v2 3/4
#4 lore raw

Re: [PATCH v2 mtd-utils 3/4] configure.ac: Add a check for execinfo and backtrace

Quoted 11 lines · Fabio Estevam

musl relies on an extenal execinfo library to provide backtrace functionality.

Add support for it.

| /work/festevam/oe/poky/build/tmp/work/core2-64-poky-linux-musl/mtd-utils/2.3.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux-musl/../../libexec/x86_64-poky-linux-musl/gcc/x86_64-poky-linux-musl/14.2.0/ld: ubifs-utils/libubifs/mkfs_ubifs-io.o: in function `dump_stack':
| /usr/src/debug/mtd-utils/2.3.0/ubifs-utils/common/defs.h:71:(.text+0x25): undefined reference to `backtrace'
....
| collect2: error: ld returned 1 exit status
| make: *** [Makefile:2959: mkfs.ubifs] Error 1

Quoted 7 lines

---
Changes since v1:
- None.

  configure.ac | 1 +
  1 file changed, 1 insertion(+)
Quoted 7 lines
configure.ac +0 -0
index 2a79ba820fc0..65afb245d89c 100644

configure.ac if test "x$need_cmocka" = "xyes"; then · line 244

Quoted 7 lines
configure.ac +1 -0
@@ -238,6 +238,7 @@ if test "x$need_cmocka" = "xyes"; then
  	PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"])
  fi
 
+AC_CHECK_LIB([execinfo], [backtrace])
  AC_CHECK_HEADERS([execinfo.h])
 
  ##### produce summary on dependencies #####

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#5 lore raw

PATCH v2 4/4 ubifs-utils: extract_files: Include <linux/limits.h>

In reply to Fabio Estevam

Include <linux/limits.h> to fix the following build error when building with musl:

| ../git/ubifs-utils/fsck.ubifs/extract_files.c: In function 'parse_ino_node':
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: error: 'XATTR_LIST_MAX' undeclared (first use in this function)
|   144 |         if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) {
|       |                                               ^~~~~~~~~~~~~~
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: note: each undeclared identifier is reported only once for each function it appears in
| make: *** [Makefile:4374: ubifs-utils/fsck.ubifs/fsck_ubifs-extract_files.o] Error 1

---
Changes since v1:
- Include <linux/limits.h>. (Zhihao)

 ubifs-utils/fsck.ubifs/extract_files.c | 2 ++
 1 file changed, 2 insertions(+)
ubifs-utils/fsck.ubifs/extract_files.c +2 -0
index c83d37749bc0..000ef5d10565 100644
@@ -10,6 +10,8 @@
 #include <getopt.h>
 #include <sys/stat.h>
 
+#include <linux/limits.h>
+
 #include "linux_err.h"
 #include "bitops.h"
 #include "kmem.h"
Signature · 6 lines
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v2 4/4
#6 lore raw

Re: [PATCH v2 mtd-utils 4/4] ubifs-utils: extract_files: Include <linux/limits.h>

Quoted 10 lines · Fabio Estevam

Include <linux/limits.h> to fix the following build error when building with musl:

| ../git/ubifs-utils/fsck.ubifs/extract_files.c: In function 'parse_ino_node':
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: error: 'XATTR_LIST_MAX' undeclared (first use in this function)
|   144 |         if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) {
|       |                                               ^~~~~~~~~~~~~~
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: note: each undeclared identifier is reported only once for each function it appears in
| make: *** [Makefile:4374: ubifs-utils/fsck.ubifs/fsck_ubifs-extract_files.o] Error 1
Quoted 7 lines

---
Changes since v1:
- Include <linux/limits.h>. (Zhihao)

  ubifs-utils/fsck.ubifs/extract_files.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 7 lines
ubifs-utils/fsck.ubifs/extract_files.c +0 -0
index c83d37749bc0..000ef5d10565 100644

ubifs-utils/fsck.ubifs/extract_files.c line 17

Quoted 8 lines
ubifs-utils/fsck.ubifs/extract_files.c +2 -0
@@ -10,6 +10,8 @@
  #include <getopt.h>
  #include <sys/stat.h>
 
+#include <linux/limits.h>
+
  #include "linux_err.h"
  #include "bitops.h"
  #include "kmem.h"

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Reviewed-by on v2 1/4
#7 lore raw
In reply to Fabio Estevam
Quoted 22 lines · Fabio Estevam

Include the <fcntl.h> header file to fix the following error when building with musl:

| In file included from ../git/ubifs-utils/common/compr.c:42:
| ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|   313 |         loff_t ui_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1341 |         loff_t i_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1342 |         loff_t d_size;
|       |         ^~~~~~
|       |         off_t
| ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'?
|  1899 |                              int deletion, loff_t new_size);
|       |                                            ^~~~~~
|       |                                            off_t
| make: *** [Makefile:4878: ubifs-utils/common/mkfs_ubifs-compr.o] Error 1
Quoted 7 lines

---
Changes since v1:
- None.

  ubifs-utils/libubifs/ubifs.h | 1 +
  1 file changed, 1 insertion(+)
Quoted 7 lines
ubifs-utils/libubifs/ubifs.h +0 -0
index 0908a2289208..1c7bc7bd0c80 100644

ubifs-utils/libubifs/ubifs.h line 17

Quoted 7 lines
ubifs-utils/libubifs/ubifs.h +1 -0
@@ -11,6 +11,7 @@
  #ifndef __UBIFS_H__
  #define __UBIFS_H__
 
+#include <fcntl.h>
  #include <string.h>
 
  #include "linux_types.h"

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/