wok-current diff linux64-cloop/stuff/cloop.u @ rev 24374

avrdude: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 05 17:11:25 2022 +0000 (2022-02-05)
parents 36e9a3dcd5de
children 5a92a26adcc1
line diff
     1.1 --- a/linux64-cloop/stuff/cloop.u	Mon May 04 09:05:12 2020 +0000
     1.2 +++ b/linux64-cloop/stuff/cloop.u	Sat Feb 05 17:11:25 2022 +0000
     1.3 @@ -1373,3 +1373,178 @@
     1.4     }
     1.5    return 0;
     1.6   init_out_dealloc:
     1.7 +--- cloop.h
     1.8 ++++ cloop.h
     1.9 +@@ -86,11 +86,8 @@
    1.10 + struct cloop_tail
    1.11 + {
    1.12 + 	u_int32_t table_size; 
    1.13 +-	u_int32_t index_size; /* size:4 comp:3 ctrl-c:1 lastlen:24 */
    1.14 ++	u_int32_t index_size; /* size:4 unused:3 ctrl-c:1 lastlen:24 */
    1.15 + #define CLOOP3_INDEX_SIZE(x)    ((unsigned int)((x) & 0xF))
    1.16 +-#define CLOOP3_BLOCKS_FLAGS(x)  ((unsigned int)((x) & 0x70) >> 4)
    1.17 +-#define CLOOP3_TRUNCATED(x)     ((unsigned int)((x) & 0x80) >> 7)
    1.18 +-#define CLOOP3_LASTLEN(x)       (unsigned int)((x) >> 8)
    1.19 + 	u_int32_t num_blocks;
    1.20 + };
    1.21 + 
    1.22 +@@ -104,8 +101,10 @@
    1.23 + };
    1.24 + 
    1.25 + static inline char *build_index(struct block_info *offsets, unsigned long n, 
    1.26 +-			unsigned long block_size, unsigned global_flags)
    1.27 ++			unsigned long block_size)
    1.28 + {
    1.29 ++	static char v[11];
    1.30 ++	u_int32_t flags = 0;
    1.31 + 	u_int32_t *ofs32 = (u_int32_t *) offsets;
    1.32 + 	loff_t    *ofs64 = (loff_t *) offsets;
    1.33 + 
    1.34 +@@ -130,8 +129,6 @@
    1.35 + 		}
    1.36 + 		else { /* V2.0/V4.0 */
    1.37 + 			loff_t last = CLOOP_BLOCK_OFFSET(__be64_to_cpu(ofs64[n]));
    1.38 +-			u_int32_t flags;
    1.39 +-			static char v4[11];
    1.40 + 			unsigned long i = n;
    1.41 + 
    1.42 + 			for (flags = 0; n-- ;) {
    1.43 +@@ -149,12 +146,7 @@
    1.44 + 					offsets[i] = offsets[offsets[i].offset];
    1.45 + 				}
    1.46 + 			}
    1.47 +-			strcpy(v4, (char *) "64BE v4.0a");
    1.48 +-			v4[10] = 'a' + ((flags-1) & 0xF);	// compressors used
    1.49 +-			if (flags > 0x10) {			// with links ?
    1.50 +-				v4[10] += 'A' - 'a';
    1.51 +-			}
    1.52 +-			return v4;
    1.53 ++			strcpy(v, (char *) "64BE v4.0a");
    1.54 + 		}
    1.55 + 	}
    1.56 + 	else if (ofs32[1] == 0 && v3_64 == 0) { /* V1.0 */
    1.57 +@@ -170,7 +162,6 @@
    1.58 + 	else { /* V3.0 or V0.68 */
    1.59 + 		unsigned long i;
    1.60 + 		loff_t j;
    1.61 +-		static char v3[11];
    1.62 + 		
    1.63 + 		for (i = 0; i < n && ntohl(ofs32[i]) < ntohl(ofs32[i+1]); i++);
    1.64 + 		if (i == n && ntohl(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */
    1.65 +@@ -185,28 +176,33 @@
    1.66 + 		}
    1.67 + 		
    1.68 + 		v3_64 = (ofs32[1] == 0);
    1.69 +-		for (i = n; i-- != 0; )
    1.70 ++		for (i = n; i-- != 0; ) {
    1.71 + 			offsets[i].size = ntohl(ofs32[i << v3_64]); 
    1.72 +-		for (i = 0, j = sizeof(struct cloop_head); i < n; i++) {
    1.73 +-			offsets[i].offset = j;
    1.74 +-			offsets[i].flags = global_flags;
    1.75 + 			if (offsets[i].size == 0xFFFFFFFF) {
    1.76 +-				offsets[i].flags = CLOOP_COMPRESSOR_NONE;
    1.77 +-				offsets[i].size = block_size;
    1.78 ++				offsets[i].size = 0x10000000 | block_size;
    1.79 + 			}
    1.80 +-			if ((offsets[i].size & 0x80000000) == 0) {
    1.81 ++			offsets[i].flags = (offsets[i].size >> 28);
    1.82 ++			offsets[i].size &= 0x0FFFFFFF; 
    1.83 ++		}
    1.84 ++		for (i = 0, j = sizeof(struct cloop_head); i < n; i++) {
    1.85 ++			offsets[i].offset = j;
    1.86 ++			if (offsets[i].flags < 8) {
    1.87 + 				j += offsets[i].size;
    1.88 + 			}
    1.89 + 		}
    1.90 + 		for (i = 0; i < n; i++) {
    1.91 +-			if (offsets[i].size & 0x80000000) {
    1.92 +-				offsets[i] = offsets[offsets[i].size & 0x7FFFFFFF];
    1.93 ++			flags |= 1 << offsets[i].flags;
    1.94 ++			if (offsets[i].flags >= 8) {
    1.95 ++				offsets[i] = offsets[offsets[i].size];
    1.96 + 			}
    1.97 + 		}
    1.98 +-		strcpy(v3, (char *) (v3_64) ? "64BE v3.0a" : "32BE v3.0a");
    1.99 +-		v3[10] += global_flags;
   1.100 +-		return v3;
   1.101 ++		strcpy(v, (char *) (v3_64) ? "64BE v3.0a" : "32BE v3.0a");
   1.102 ++	}
   1.103 ++	v[10] = 'a' + ((flags-1) & 0xF);	// compressors used
   1.104 ++	if (flags > 0x10) {			// with links ?
   1.105 ++		v[10] += 'A' - 'a';
   1.106 + 	}
   1.107 ++	return v;
   1.108 + }
   1.109 + 
   1.110 + /* Cloop suspend IOCTL */
   1.111 +--- cloop.c
   1.112 ++++ cloop.c
   1.113 +@@ -542,7 +542,7 @@
   1.114 +  const unsigned int header_size = sizeof(struct cloop_head);
   1.115 +  unsigned int i, total_offsets=0;
   1.116 +  loff_t fs_read_position = 0, header_pos[2];
   1.117 +- int flags, isblkdev, bytes_read, error = 0;
   1.118 ++ int isblkdev, bytes_read, error = 0;
   1.119 +  if (clo->suspended) return error;
   1.120 +  #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
   1.121 +  inode = file->f_dentry->d_inode;
   1.122 +@@ -698,18 +698,12 @@
   1.123 +        error=-EBADF; goto error_release;
   1.124 +       }
   1.125 +      len = CLOOP3_INDEX_SIZE(ntohl(tail.index_size)) * total_offsets;
   1.126 +-     flags = CLOOP3_BLOCKS_FLAGS(ntohl(tail.index_size));
   1.127 +-// May  3 19:45:20 (none) user.info kernel: cloop: uncompress(clo=e0a78000, block_ptrs=e0c9c000, &len(1440)=ddc05e6c, zbuf=e0c9f000, zlen=43, flag=0)
   1.128 +-printk(KERN_INFO "%s: uncompress(clo=%p, block_ptrs=%p, &len(%ld)=%p, zbuf=%p, zlen=%ld, flag=%d)\n", cloop_name, 
   1.129 +-		clo, clo->block_ptrs, len, &len, zbuf, zlen, flags);
   1.130 +-     ret = uncompress(clo, (void *) clo->block_ptrs, &len, zbuf, zlen, flags);
   1.131 +-// May  3 19:45:20 (none) user.alert kernel: BUG: unable to handle kernel NULL pointer dereference at   (null)
   1.132 +-printk(KERN_INFO "%s: uncompressed !\n", cloop_name);
   1.133 ++     ret = uncompress(clo, (void *) clo->block_ptrs, &len, zbuf, zlen, CLOOP_COMPRESSOR_ZLIB);
   1.134 +      cloop_free(zbuf, zlen);
   1.135 +      if (ret != 0)
   1.136 +       {
   1.137 +-        printk(KERN_ERR "%s: decompression error %i uncompressing index, flags %u\n",
   1.138 +-               cloop_name, ret, flags);
   1.139 ++        printk(KERN_ERR "%s: decompression error %i uncompressing index\n",
   1.140 ++               cloop_name, ret);
   1.141 +        error=-EBADF; goto error_release;
   1.142 +       }
   1.143 +     }
   1.144 +@@ -722,7 +716,6 @@
   1.145 +  else
   1.146 +   {
   1.147 +    unsigned int n, total_bytes;
   1.148 +-   flags = 0;
   1.149 +    clo->block_ptrs = cloop_malloc(sizeof(struct block_info) * total_offsets);
   1.150 +    if (!clo->block_ptrs)
   1.151 +     {
   1.152 +@@ -761,7 +754,7 @@
   1.153 +   }
   1.154 +  {
   1.155 +   int i;
   1.156 +-  char *version = build_index(clo->block_ptrs, clo->head.num_blocks, clo->head.block_size, flags);
   1.157 ++  char *version = build_index(clo->block_ptrs, clo->head.num_blocks, clo->head.block_size);
   1.158 +   clo->largest_block = 0;
   1.159 +   for (i = 0; i < clo->head.num_blocks; i++)
   1.160 +     if (clo->block_ptrs[i].size > clo->largest_block)
   1.161 +@@ -769,9 +762,6 @@
   1.162 +   printk(KERN_INFO "%s: %s: %s: %u blocks, %u bytes/block, largest block is %lu bytes.\n",
   1.163 +          cloop_name, clo->underlying_filename, version, clo->head.num_blocks,
   1.164 +          clo->head.block_size, clo->largest_block);
   1.165 +- }
   1.166 +- {
   1.167 +-  int i;
   1.168 +   clo->num_buffered_blocks = (buffers > 0 && clo->head.block_size >= 512) ?
   1.169 +                               (buffers / clo->head.block_size) : 1;
   1.170 +   clo->buffered_blocknum = cloop_malloc(clo->num_buffered_blocks * sizeof (u_int32_t));
   1.171 +@@ -874,6 +864,10 @@
   1.172 +  cloop_free(clo->block_ptrs, sizeof(struct block_info) * total_offsets);
   1.173 +  clo->block_ptrs=NULL;
   1.174 + error_release:
   1.175 ++#if (defined(CONFIG_ZLIB_INFLATE) || defined(CONFIG_ZLIB_INFLATE_MODULE))
   1.176 ++ zlib_inflateEnd(&clo->zstream);
   1.177 ++ if(clo->zstream.workspace) { cloop_free(clo->zstream.workspace, zlib_inflate_workspacesize()); clo->zstream.workspace = NULL; }
   1.178 ++#endif
   1.179 +  if(bbuf) cloop_free(bbuf, clo->underlying_blksize);
   1.180 +  if(clo->underlying_filename) { kfree(clo->underlying_filename); clo->underlying_filename=NULL; }
   1.181 +  clo->backing_file=NULL;