Mkfs.jffs2.c:68:21: sys/acl.h: No such file or directory

Ricard Wanderlof ricard.wanderlof at axis.com
Wed Nov 15 03:02:34 EST 2006


On Wed, 15 Nov 2006, KokHow.Teh at infineon.com wrote:

> 	I am trying to build mtd-utils-1.0.1 using a mips cross
> toolchain and I am stumbled at mkfs.jffs2 which includes sys/acl.h and
> it is not present anywhere in my mips toolchain include directory but it
> is present in my host /usr/include/sys/acl.h Has anybody encoutered this
> problem before that you could enlighten me on this?

We've encountered the same problem. I'll expose my ignorance here and say 
that all I know is that acl.h is used for some form of access control list 
feature that has been introduced to mkfs.jffs2, but I don't really know 
what it is for.

We didn't need this feature either so I made a patch to optionally remove 
it from the source, controlled by a #define; it is included as an 
attachment and in the text below. Don't know if this should really be 
included in the main stream source. Obviously at least two people have 
come up against this as a problem.

/Ricard


--- mtd-utils-1.0.1/mkfs.jffs2.c	2006-09-18 09:42:57.000000000 +0200
+++ mtdutils/mkfs.jffs2.c	2006-10-17 13:40:40.000000000 +0200
@@ -47,6 +47,8 @@
   *  -Erik, November 2002
   */

+#undef HAVE_ACL
+
  #define _GNU_SOURCE
  #include <sys/types.h>
  #include <stdio.h>
@@ -65,7 +67,9 @@
  #include <time.h>
  #include <getopt.h>
  #include <sys/xattr.h>
+#ifdef HAVE_ACL
  #include <sys/acl.h>
+#endif
  #include <byteswap.h>
  #define crc32 __complete_crap
  #include <zlib.h>
@@ -1030,6 +1034,7 @@
  	padword();
  }

+#ifdef HAVE_ACL
  typedef struct xattr_entry {
  	struct xattr_entry *next;
  	uint32_t xid;
@@ -1258,6 +1263,10 @@
  		padword();
  	}
  }
+#else
+/* don't do anything, corresponds to  if (!enable_xattr) return;  above */
+#define write_xattr_entry(x)
+#endif

  static void recursive_populate_directory(struct filesystem_entry *dir)
  {
@@ -1451,9 +1460,11 @@
  	"  -q, --squash            Squash permissions and owners making all files be owned by root\n"
  	"  -U, --squash-uids       Squash owners making all files be owned by root\n"
  	"  -P, --squash-perms      Squash permissions on all files\n"
+#ifdef HAVE_ACL
  	"      --with-xattr        stuff all xattr entries into image\n"
  	"      --with-selinux      stuff only SELinux Labels into jffs2 image\n"
  	"      --with-posix-acl    stuff only POSIX ACL entries into jffs2 image\n"
+#endif
  	"  -h, --help              Display this help text\n"
  	"  -v, --verbose           Verbose operation\n"
  	"  -V, --version           Display version information\n"
@@ -1772,6 +1783,7 @@
  					perror_msg_and_die("cannot open (incremental) file");
  				}
  				break;
+#ifdef HAVE_ACL
  			case 1000:	/* --with-xattr  */
  				enable_xattr |= (1 << JFFS2_XPREFIX_USER)
  						| (1 << JFFS2_XPREFIX_SECURITY)
@@ -1786,6 +1798,7 @@
  				enable_xattr |= (1 << JFFS2_XPREFIX_ACL_ACCESS)
  						| (1 << JFFS2_XPREFIX_ACL_DEFAULT);
  				break;
+#endif
  		}
  	}
  	if (out_fd == -1) {

--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
-------------- next part --------------
--- mtd-utils-1.0.1/mkfs.jffs2.c	2006-09-18 09:42:57.000000000 +0200
+++ mtdutils/mkfs.jffs2.c	2006-10-17 13:40:40.000000000 +0200
@@ -47,6 +47,8 @@
  *  -Erik, November 2002
  */
 
+#undef HAVE_ACL
+
 #define _GNU_SOURCE
 #include <sys/types.h>
 #include <stdio.h>
@@ -65,7 +67,9 @@
 #include <time.h>
 #include <getopt.h>
 #include <sys/xattr.h>
+#ifdef HAVE_ACL
 #include <sys/acl.h>
+#endif
 #include <byteswap.h>
 #define crc32 __complete_crap
 #include <zlib.h>
@@ -1030,6 +1034,7 @@
 	padword();
 }
 
+#ifdef HAVE_ACL
 typedef struct xattr_entry {
 	struct xattr_entry *next;
 	uint32_t xid;
@@ -1258,6 +1263,10 @@
 		padword();
 	}
 }
+#else
+/* don't do anything, corresponds to  if (!enable_xattr) return;  above */
+#define write_xattr_entry(x)
+#endif
 
 static void recursive_populate_directory(struct filesystem_entry *dir)
 {
@@ -1451,9 +1460,11 @@
 	"  -q, --squash            Squash permissions and owners making all files be owned by root\n"
 	"  -U, --squash-uids       Squash owners making all files be owned by root\n"
 	"  -P, --squash-perms      Squash permissions on all files\n"
+#ifdef HAVE_ACL
 	"      --with-xattr        stuff all xattr entries into image\n"
 	"      --with-selinux      stuff only SELinux Labels into jffs2 image\n"
 	"      --with-posix-acl    stuff only POSIX ACL entries into jffs2 image\n"
+#endif
 	"  -h, --help              Display this help text\n"
 	"  -v, --verbose           Verbose operation\n"
 	"  -V, --version           Display version information\n"
@@ -1772,6 +1783,7 @@
 					perror_msg_and_die("cannot open (incremental) file");
 				}
 				break;
+#ifdef HAVE_ACL
 			case 1000:	/* --with-xattr  */
 				enable_xattr |= (1 << JFFS2_XPREFIX_USER)
 						| (1 << JFFS2_XPREFIX_SECURITY)
@@ -1786,6 +1798,7 @@
 				enable_xattr |= (1 << JFFS2_XPREFIX_ACL_ACCESS)
 						| (1 << JFFS2_XPREFIX_ACL_DEFAULT);
 				break;
+#endif
 		}
 	}
 	if (out_fd == -1) {


More information about the linux-mtd mailing list