wok rev 909

Squashfs: split kernel module and userland tools.
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 15 18:44:02 2008 +0000 (2008-06-15)
parents 674428d9fabf
children 7f4b6a1eec61
files squashfs-module/receipt squashfs/receipt squashfs/stuff/squashfs-patch-2.6.25
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/squashfs-module/receipt	Sun Jun 15 18:44:02 2008 +0000
     1.3 @@ -0,0 +1,29 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="squashfs-module"
     1.7 +VERSION="3.3"
     1.8 +CATEGORY="base-system"
     1.9 +SHORT_DESC="Linux squashfs module."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="http://$PACKAGE.sourceforge.net/"
    1.12 +WANTED="squashfs"
    1.13 +
    1.14 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.15 +genpkg_rules()
    1.16 +{
    1.17 +	kver=$(grep "kernel version" ../linux/linux-*/.config)
    1.18 +	kver=${kver##* }
    1.19 +	EXTRAVERSION=_$kver
    1.20 +	cp -a $src/_pkg/lib $fs
    1.21 +}
    1.22 +
    1.23 +# Post install/remove commands for Tazpkg.
    1.24 +post_install()
    1.25 +{
    1.26 +	depmod -a -b "$1/"
    1.27 +}
    1.28 +
    1.29 +post_remove()
    1.30 +{
    1.31 +	depmod -a
    1.32 +}
     2.1 --- a/squashfs/receipt	Sun Jun 15 18:08:57 2008 +0200
     2.2 +++ b/squashfs/receipt	Sun Jun 15 18:44:02 2008 +0000
     2.3 @@ -3,12 +3,12 @@
     2.4  PACKAGE="squashfs"
     2.5  VERSION="3.3"
     2.6  CATEGORY="base-system"
     2.7 -SHORT_DESC="Linux squashfs module and userland tools."
     2.8 +SHORT_DESC="Linux squashfs userland tools."
     2.9  MAINTAINER="pascal.bellard@slitaz.org"
    2.10  WEB_SITE="http://$PACKAGE.sourceforge.net/"
    2.11  TARBALL="squashfs$VERSION.tgz"
    2.12  WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    2.13 -DEPENDS="zlib"
    2.14 +DEPENDS="zlib squashfs-module"
    2.15  BUILD_DEPENDS="zlib-dev patch"
    2.16  
    2.17  # Rules to configure and make the package.
    2.18 @@ -17,6 +17,7 @@
    2.19  	local kver
    2.20  	local patch_dir
    2.21  
    2.22 +	ln -s . $src
    2.23  	# get kernel version
    2.24  	if [ ! -d ../linux/taz ]; then
    2.25  		tazwok cook linux
    2.26 @@ -26,7 +27,13 @@
    2.27  
    2.28  	# Select patch according to kernel version
    2.29  	patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-${kver%.*}
    2.30 -	if [ -f ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
    2.31 +	i=${patch_dir##*.}
    2.32 +	while [ ! -d ${patch_dir%.*}.$i ]; do
    2.33 +		[ "$i" = "0" ] && break
    2.34 +		i=$(($i - 1))
    2.35 +	done
    2.36 +	patch_dir=${patch_dir%.*}.$i
    2.37 +	if [ -d ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
    2.38  		patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-$kver
    2.39  	fi
    2.40  	if [ ! -d $patch_dir ]; then
    2.41 @@ -36,7 +43,7 @@
    2.42  	[ -d _kernel ] && rm -rf _kernel
    2.43  	mkdir _kernel
    2.44  	cd _kernel
    2.45 -	ln -s ../../linux/linux-$kver* src
    2.46 +	ln -fs ../../linux/linux-$kver* src
    2.47  
    2.48  	# Copy files to be patched in local aera
    2.49  	# Do not alter kernel sources !!
    2.50 @@ -46,7 +53,16 @@
    2.51  	done
    2.52  
    2.53  	# Apply squashfs patches in local aera
    2.54 -	patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
    2.55 +	#patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
    2.56 +	echo "Apply $patch_dir..."
    2.57 +	awk 'BEGIN { keep=1} /^---/ { keep=(index($0,"/fs/squashfs/") || index($0,"/include/linux/"))} { if (keep) print }' < \
    2.58 +		../$patch_dir/${PACKAGE}${VERSION}-patch | patch -p1
    2.59 +
    2.60 +	extra_patch=stuff/squashfs-patch-${kver%.*}
    2.61 +	if [ -e ../$extra_patch ]; then
    2.62 +		echo "Apply $extra_patch..."
    2.63 +		patch -p1 < ../$extra_patch || return 1
    2.64 +	fi
    2.65  
    2.66  	# Move every files in fs/squashfs directory
    2.67  	mv include/linux/* fs/squashfs
    2.68 @@ -56,6 +72,10 @@
    2.69  		sed -e 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' > $i < $i.$$
    2.70  	done
    2.71  	
    2.72 +	# Apply lzma patches
    2.73 +#	echo "Apply stuff/lzma.u.."
    2.74 +#	patch -p0 < ../stuff/lzma.u
    2.75 +	
    2.76  	# Build kernel module
    2.77  	make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules
    2.78  	cd ..
    2.79 @@ -76,13 +96,13 @@
    2.80  # Rules to gen a SliTaz package suitable for Tazpkg.
    2.81  genpkg_rules()
    2.82  {
    2.83 -	cp -a _pkg/* $fs
    2.84 +	cp -a _pkg/usr _pkg/sbin $fs
    2.85  }
    2.86  
    2.87  # Post install/remove commands for Tazpkg.
    2.88  post_install()
    2.89  {
    2.90 -	depmod -a -b /$1
    2.91 +	depmod -a -b "$1/"
    2.92  }
    2.93  
    2.94  post_remove()
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/squashfs/stuff/squashfs-patch-2.6.25	Sun Jun 15 18:44:02 2008 +0000
     3.3 @@ -0,0 +1,161 @@
     3.4 +diff -x .gitignore -Nurp linux-2.6.25-rc7.orig/fs/squashfs/inode.c linux-2.6.25-rc7.new/fs/squashfs/inode.c
     3.5 +--- linux-2.6.25-rc7.orig/fs/squashfs/inode.c	2008-04-05 00:19:09.000000000 +0100
     3.6 ++++ linux-2.6.25-rc7.new/fs/squashfs/inode.c	2008-04-05 00:22:44.000000000 +0100
     3.7 +@@ -1,7 +1,7 @@
     3.8 + /*
     3.9 +  * Squashfs - a compressed read only filesystem for Linux
    3.10 +  *
    3.11 +- * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
    3.12 ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
    3.13 +  * Phillip Lougher <phillip@lougher.demon.co.uk>
    3.14 +  *
    3.15 +  * This program is free software; you can redistribute it and/or
    3.16 +@@ -37,7 +37,10 @@
    3.17 + 
    3.18 + int squashfs_cached_blks;
    3.19 + 
    3.20 +-static void vfs_read_inode(struct inode *i);
    3.21 ++static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
    3.22 ++		struct fid *fid, int fh_len, int fh_type);
    3.23 ++static struct dentry *squashfs_fh_to_parent(struct super_block *s,
    3.24 ++		struct fid *fid, int fh_len, int fh_type);
    3.25 + static struct dentry *squashfs_get_parent(struct dentry *child);
    3.26 + static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
    3.27 + static int squashfs_statfs(struct dentry *, struct kstatfs *);
    3.28 +@@ -78,15 +81,9 @@ static struct super_operations squashfs_
    3.29 + 	.remount_fs = squashfs_remount
    3.30 + };
    3.31 + 
    3.32 +-static struct super_operations squashfs_export_super_ops = {
    3.33 +-	.alloc_inode = squashfs_alloc_inode,
    3.34 +-	.destroy_inode = squashfs_destroy_inode,
    3.35 +-	.statfs = squashfs_statfs,
    3.36 +-	.put_super = squashfs_put_super,
    3.37 +-	.read_inode = vfs_read_inode
    3.38 +-};
    3.39 +-
    3.40 + static struct export_operations squashfs_export_ops = {
    3.41 ++	.fh_to_dentry = squashfs_fh_to_dentry,
    3.42 ++	.fh_to_parent = squashfs_fh_to_parent,
    3.43 + 	.get_parent = squashfs_get_parent
    3.44 + };
    3.45 + 
    3.46 +@@ -630,42 +627,72 @@ static squashfs_inode_t squashfs_inode_l
    3.47 + out:
    3.48 + 	return SQUASHFS_INVALID_BLK;
    3.49 + }
    3.50 +-	
    3.51 + 
    3.52 +-static void vfs_read_inode(struct inode *i)
    3.53 ++
    3.54 ++
    3.55 ++static struct dentry *squashfs_export_iget(struct super_block *s,
    3.56 ++	unsigned int inode_number)
    3.57 + {
    3.58 +-	struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
    3.59 +-	squashfs_inode_t inode = squashfs_inode_lookup(i->i_sb, i->i_ino);
    3.60 ++	squashfs_inode_t inode;
    3.61 ++	struct inode *i;
    3.62 ++	struct dentry *dentry;
    3.63 + 
    3.64 +-	TRACE("Entered vfs_read_inode\n");
    3.65 ++	TRACE("Entered squashfs_export_iget\n");
    3.66 + 
    3.67 +-	if(inode != SQUASHFS_INVALID_BLK)
    3.68 +-		(msblk->read_inode)(i, inode);
    3.69 ++	inode = squashfs_inode_lookup(s, inode_number);
    3.70 ++	if(inode == SQUASHFS_INVALID_BLK) {
    3.71 ++		dentry = ERR_PTR(-ENOENT);
    3.72 ++		goto failure;
    3.73 ++	}
    3.74 ++
    3.75 ++	i = squashfs_iget(s, inode, inode_number);
    3.76 ++	if(i == NULL) {
    3.77 ++		dentry = ERR_PTR(-EACCES);
    3.78 ++		goto failure;
    3.79 ++	}
    3.80 ++
    3.81 ++	dentry = d_alloc_anon(i);
    3.82 ++	if (dentry == NULL) {
    3.83 ++		iput(i);
    3.84 ++		dentry = ERR_PTR(-ENOMEM);
    3.85 ++	}
    3.86 ++
    3.87 ++failure:
    3.88 ++	return dentry;
    3.89 ++}
    3.90 ++
    3.91 ++
    3.92 ++static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
    3.93 ++		struct fid *fid, int fh_len, int fh_type)
    3.94 ++{
    3.95 ++	if((fh_type != FILEID_INO32_GEN && fh_type != FILEID_INO32_GEN_PARENT) ||
    3.96 ++			fh_len < 2)
    3.97 ++		return NULL;
    3.98 ++
    3.99 ++	return squashfs_export_iget(s, fid->i32.ino);
   3.100 ++}
   3.101 ++
   3.102 ++
   3.103 ++static struct dentry *squashfs_fh_to_parent(struct super_block *s,
   3.104 ++		struct fid *fid, int fh_len, int fh_type)
   3.105 ++{
   3.106 ++	if(fh_type != FILEID_INO32_GEN_PARENT || fh_len < 4)
   3.107 ++		return NULL;
   3.108 ++
   3.109 ++	return squashfs_export_iget(s, fid->i32.parent_ino);
   3.110 + }
   3.111 + 
   3.112 + 
   3.113 + static struct dentry *squashfs_get_parent(struct dentry *child)
   3.114 + {
   3.115 + 	struct inode *i = child->d_inode;
   3.116 +-	struct inode *parent = iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
   3.117 +-	struct dentry *rv;
   3.118 + 
   3.119 + 	TRACE("Entered squashfs_get_parent\n");
   3.120 + 
   3.121 +-	if(parent == NULL) {
   3.122 +-		rv = ERR_PTR(-EACCES);
   3.123 +-		goto out;
   3.124 +-	}
   3.125 +-
   3.126 +-	rv = d_alloc_anon(parent);
   3.127 +-	if(rv == NULL)
   3.128 +-		rv = ERR_PTR(-ENOMEM);
   3.129 +-
   3.130 +-out:
   3.131 +-	return rv;
   3.132 ++	return squashfs_export_iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
   3.133 + }
   3.134 + 
   3.135 +-	
   3.136 ++
   3.137 + SQSH_EXTERN struct inode *squashfs_iget(struct super_block *s,
   3.138 + 				squashfs_inode_t inode, unsigned int inode_number)
   3.139 + {
   3.140 +@@ -1257,7 +1284,6 @@ static int squashfs_fill_super(struct su
   3.141 + 	if (read_inode_lookup_table(s) == 0)
   3.142 + 		goto failed_mount;
   3.143 + 
   3.144 +-	s->s_op = &squashfs_export_super_ops;
   3.145 + 	s->s_export_op = &squashfs_export_ops;
   3.146 + 
   3.147 + allocate_root:
   3.148 +@@ -2124,7 +2150,7 @@ static int __init init_squashfs_fs(void)
   3.149 + 	if (err)
   3.150 + 		goto out;
   3.151 + 
   3.152 +-	printk(KERN_INFO "squashfs: version 3.3 (2007/10/31) "
   3.153 ++	printk(KERN_INFO "squashfs: version 3.3-CVS (2008/04/04) "
   3.154 + 		"Phillip Lougher\n");
   3.155 + 
   3.156 + 	err = register_filesystem(&squashfs_fs_type);
   3.157 +@@ -2187,6 +2213,6 @@ static void destroy_inodecache(void)
   3.158 + 
   3.159 + module_init(init_squashfs_fs);
   3.160 + module_exit(exit_squashfs_fs);
   3.161 +-MODULE_DESCRIPTION("squashfs 3.2-r2-CVS, a compressed read-only filesystem");
   3.162 ++MODULE_DESCRIPTION("squashfs 3.3, a compressed read-only filesystem");
   3.163 + MODULE_AUTHOR("Phillip Lougher <phillip@lougher.demon.co.uk>");
   3.164 + MODULE_LICENSE("GPL");