diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/connector.h | 5 | ||||
-rw-r--r-- | include/linux/dcache.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 1 | ||||
-rw-r--r-- | include/linux/key.h | 23 | ||||
-rw-r--r-- | include/linux/netlink.h | 2 | ||||
-rw-r--r-- | include/linux/pci.h | 4 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 11 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 1 | ||||
-rw-r--r-- | include/linux/security.h | 10 | ||||
-rw-r--r-- | include/linux/zconf.h | 12 | ||||
-rw-r--r-- | include/linux/zlib.h | 209 | ||||
-rw-r--r-- | include/linux/zutil.h | 12 |
12 files changed, 187 insertions, 105 deletions
diff --git a/include/linux/connector.h b/include/linux/connector.h index ad1a22c1c42e..4c02119c6ab9 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -34,8 +34,11 @@ | |||
34 | #define CN_VAL_PROC 0x1 | 34 | #define CN_VAL_PROC 0x1 |
35 | #define CN_IDX_CIFS 0x2 | 35 | #define CN_IDX_CIFS 0x2 |
36 | #define CN_VAL_CIFS 0x1 | 36 | #define CN_VAL_CIFS 0x1 |
37 | #define CN_W1_IDX 0x3 /* w1 communication */ | ||
38 | #define CN_W1_VAL 0x1 | ||
37 | 39 | ||
38 | #define CN_NETLINK_USERS 1 | 40 | |
41 | #define CN_NETLINK_USERS 4 | ||
39 | 42 | ||
40 | /* | 43 | /* |
41 | * Maximum connector's message size. | 44 | * Maximum connector's message size. |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 836325ee0931..46d0e079735d 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -217,7 +217,7 @@ extern struct dentry * d_alloc_anon(struct inode *); | |||
217 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); | 217 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
218 | extern void shrink_dcache_sb(struct super_block *); | 218 | extern void shrink_dcache_sb(struct super_block *); |
219 | extern void shrink_dcache_parent(struct dentry *); | 219 | extern void shrink_dcache_parent(struct dentry *); |
220 | extern void shrink_dcache_anon(struct hlist_head *); | 220 | extern void shrink_dcache_anon(struct super_block *); |
221 | extern int d_invalidate(struct dentry *); | 221 | extern int d_invalidate(struct dentry *); |
222 | 222 | ||
223 | /* only used at mount-time */ | 223 | /* only used at mount-time */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index ecc8c2c3d8ca..73c7d6f04b31 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -782,7 +782,6 @@ extern int setlease(struct file *, long, struct file_lock **); | |||
782 | extern int lease_modify(struct file_lock **, int); | 782 | extern int lease_modify(struct file_lock **, int); |
783 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 783 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
784 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 784 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
785 | extern void steal_locks(fl_owner_t from); | ||
786 | 785 | ||
787 | struct fasync_struct { | 786 | struct fasync_struct { |
788 | int magic; | 787 | int magic; |
diff --git a/include/linux/key.h b/include/linux/key.h index cbf464ad9589..e81ebf910d0b 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -205,6 +205,11 @@ struct key_type { | |||
205 | /* match a key against a description */ | 205 | /* match a key against a description */ |
206 | int (*match)(const struct key *key, const void *desc); | 206 | int (*match)(const struct key *key, const void *desc); |
207 | 207 | ||
208 | /* clear some of the data from a key on revokation (optional) | ||
209 | * - the key's semaphore will be write-locked by the caller | ||
210 | */ | ||
211 | void (*revoke)(struct key *key); | ||
212 | |||
208 | /* clear the data from a key (optional) */ | 213 | /* clear the data from a key (optional) */ |
209 | void (*destroy)(struct key *key); | 214 | void (*destroy)(struct key *key); |
210 | 215 | ||
@@ -241,8 +246,9 @@ extern void unregister_key_type(struct key_type *ktype); | |||
241 | 246 | ||
242 | extern struct key *key_alloc(struct key_type *type, | 247 | extern struct key *key_alloc(struct key_type *type, |
243 | const char *desc, | 248 | const char *desc, |
244 | uid_t uid, gid_t gid, key_perm_t perm, | 249 | uid_t uid, gid_t gid, |
245 | int not_in_quota); | 250 | struct task_struct *ctx, |
251 | key_perm_t perm, int not_in_quota); | ||
246 | extern int key_payload_reserve(struct key *key, size_t datalen); | 252 | extern int key_payload_reserve(struct key *key, size_t datalen); |
247 | extern int key_instantiate_and_link(struct key *key, | 253 | extern int key_instantiate_and_link(struct key *key, |
248 | const void *data, | 254 | const void *data, |
@@ -292,7 +298,9 @@ extern int key_unlink(struct key *keyring, | |||
292 | struct key *key); | 298 | struct key *key); |
293 | 299 | ||
294 | extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, | 300 | extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, |
295 | int not_in_quota, struct key *dest); | 301 | struct task_struct *ctx, |
302 | int not_in_quota, | ||
303 | struct key *dest); | ||
296 | 304 | ||
297 | extern int keyring_clear(struct key *keyring); | 305 | extern int keyring_clear(struct key *keyring); |
298 | 306 | ||
@@ -313,7 +321,8 @@ extern void keyring_replace_payload(struct key *key, void *replacement); | |||
313 | * the userspace interface | 321 | * the userspace interface |
314 | */ | 322 | */ |
315 | extern struct key root_user_keyring, root_session_keyring; | 323 | extern struct key root_user_keyring, root_session_keyring; |
316 | extern int alloc_uid_keyring(struct user_struct *user); | 324 | extern int alloc_uid_keyring(struct user_struct *user, |
325 | struct task_struct *ctx); | ||
317 | extern void switch_uid_keyring(struct user_struct *new_user); | 326 | extern void switch_uid_keyring(struct user_struct *new_user); |
318 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); | 327 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); |
319 | extern int copy_thread_group_keys(struct task_struct *tsk); | 328 | extern int copy_thread_group_keys(struct task_struct *tsk); |
@@ -342,7 +351,7 @@ extern void key_init(void); | |||
342 | #define make_key_ref(k) ({ NULL; }) | 351 | #define make_key_ref(k) ({ NULL; }) |
343 | #define key_ref_to_ptr(k) ({ NULL; }) | 352 | #define key_ref_to_ptr(k) ({ NULL; }) |
344 | #define is_key_possessed(k) 0 | 353 | #define is_key_possessed(k) 0 |
345 | #define alloc_uid_keyring(u) 0 | 354 | #define alloc_uid_keyring(u,c) 0 |
346 | #define switch_uid_keyring(u) do { } while(0) | 355 | #define switch_uid_keyring(u) do { } while(0) |
347 | #define __install_session_keyring(t, k) ({ NULL; }) | 356 | #define __install_session_keyring(t, k) ({ NULL; }) |
348 | #define copy_keys(f,t) 0 | 357 | #define copy_keys(f,t) 0 |
@@ -355,6 +364,10 @@ extern void key_init(void); | |||
355 | #define key_fsgid_changed(t) do { } while(0) | 364 | #define key_fsgid_changed(t) do { } while(0) |
356 | #define key_init() do { } while(0) | 365 | #define key_init() do { } while(0) |
357 | 366 | ||
367 | /* Initial keyrings */ | ||
368 | extern struct key root_user_keyring; | ||
369 | extern struct key root_session_keyring; | ||
370 | |||
358 | #endif /* CONFIG_KEYS */ | 371 | #endif /* CONFIG_KEYS */ |
359 | #endif /* __KERNEL__ */ | 372 | #endif /* __KERNEL__ */ |
360 | #endif /* _LINUX_KEY_H */ | 373 | #endif /* _LINUX_KEY_H */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 87b8a5703ebc..855b44668caa 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | 6 | ||
7 | #define NETLINK_ROUTE 0 /* Routing/device hook */ | 7 | #define NETLINK_ROUTE 0 /* Routing/device hook */ |
8 | #define NETLINK_W1 1 /* 1-wire subsystem */ | 8 | #define NETLINK_UNUSED 1 /* Unused number */ |
9 | #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ | 9 | #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ |
10 | #define NETLINK_FIREWALL 3 /* Firewalling hook */ | 10 | #define NETLINK_FIREWALL 3 /* Firewalling hook */ |
11 | #define NETLINK_INET_DIAG 4 /* INET socket monitoring */ | 11 | #define NETLINK_INET_DIAG 4 /* INET socket monitoring */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 6c4bc773f7b7..62a8c22f5f60 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -162,6 +162,9 @@ struct pci_dev { | |||
162 | unsigned int is_busmaster:1; /* device is busmaster */ | 162 | unsigned int is_busmaster:1; /* device is busmaster */ |
163 | unsigned int no_msi:1; /* device may not use msi */ | 163 | unsigned int no_msi:1; /* device may not use msi */ |
164 | unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ | 164 | unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ |
165 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | ||
166 | unsigned int msi_enabled:1; | ||
167 | unsigned int msix_enabled:1; | ||
165 | 168 | ||
166 | u32 saved_config_space[16]; /* config space saved at suspend time */ | 169 | u32 saved_config_space[16]; /* config space saved at suspend time */ |
167 | struct hlist_head saved_cap_space; | 170 | struct hlist_head saved_cap_space; |
@@ -496,6 +499,7 @@ int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | |||
496 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | 499 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); |
497 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 500 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
498 | int pci_assign_resource(struct pci_dev *dev, int i); | 501 | int pci_assign_resource(struct pci_dev *dev, int i); |
502 | int pci_assign_resource_fixed(struct pci_dev *dev, int i); | ||
499 | void pci_restore_bars(struct pci_dev *dev); | 503 | void pci_restore_bars(struct pci_dev *dev); |
500 | 504 | ||
501 | /* ROM control related routines */ | 505 | /* ROM control related routines */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index d33436097e1d..cde701c13c77 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -851,7 +851,12 @@ | |||
851 | 851 | ||
852 | 852 | ||
853 | #define PCI_VENDOR_ID_QLOGIC 0x1077 | 853 | #define PCI_VENDOR_ID_QLOGIC 0x1077 |
854 | #define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016 | ||
854 | #define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 | 855 | #define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 |
856 | #define PCI_DEVICE_ID_QLOGIC_ISP1080 0x1080 | ||
857 | #define PCI_DEVICE_ID_QLOGIC_ISP12160 0x1216 | ||
858 | #define PCI_DEVICE_ID_QLOGIC_ISP1240 0x1240 | ||
859 | #define PCI_DEVICE_ID_QLOGIC_ISP1280 0x1280 | ||
855 | #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 | 860 | #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 |
856 | #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 | 861 | #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 |
857 | #define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 | 862 | #define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 |
@@ -1021,6 +1026,7 @@ | |||
1021 | #define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 | 1026 | #define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 |
1022 | #define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 | 1027 | #define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 |
1023 | #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 | 1028 | #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 |
1029 | #define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d | ||
1024 | #define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 | 1030 | #define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 |
1025 | #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 | 1031 | #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 |
1026 | #define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 | 1032 | #define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 |
@@ -1951,6 +1957,7 @@ | |||
1951 | 1957 | ||
1952 | #define PCI_VENDOR_ID_MELLANOX 0x15b3 | 1958 | #define PCI_VENDOR_ID_MELLANOX 0x15b3 |
1953 | #define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 | 1959 | #define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 |
1960 | #define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 | ||
1954 | #define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 | 1961 | #define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 |
1955 | #define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 | 1962 | #define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 |
1956 | #define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c | 1963 | #define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c |
@@ -1974,6 +1981,9 @@ | |||
1974 | #define PCI_VENDOR_ID_NETCELL 0x169c | 1981 | #define PCI_VENDOR_ID_NETCELL 0x169c |
1975 | #define PCI_DEVICE_ID_REVOLUTION 0x0044 | 1982 | #define PCI_DEVICE_ID_REVOLUTION 0x0044 |
1976 | 1983 | ||
1984 | #define PCI_VENDOR_ID_VITESSE 0x1725 | ||
1985 | #define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 | ||
1986 | |||
1977 | #define PCI_VENDOR_ID_LINKSYS 0x1737 | 1987 | #define PCI_VENDOR_ID_LINKSYS 0x1737 |
1978 | #define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 | 1988 | #define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 |
1979 | 1989 | ||
@@ -2153,6 +2163,7 @@ | |||
2153 | #define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 | 2163 | #define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 |
2154 | #define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e | 2164 | #define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e |
2155 | #define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 | 2165 | #define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 |
2166 | #define PCI_DEVICE_ID_INTEL_GD31244 0x3200 | ||
2156 | #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 | 2167 | #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 |
2157 | #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 | 2168 | #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 |
2158 | #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 | 2169 | #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index d27a78b71297..6bce4a240364 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -197,6 +197,7 @@ | |||
197 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ | 197 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ |
198 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ | 198 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ |
199 | #define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ | 199 | #define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ |
200 | #define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ | ||
200 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | 201 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ |
201 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | 202 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ |
202 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | 203 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ |
diff --git a/include/linux/security.h b/include/linux/security.h index 4dfb1b84a9b3..47722d355532 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1313,7 +1313,7 @@ struct security_operations { | |||
1313 | 1313 | ||
1314 | /* key management security hooks */ | 1314 | /* key management security hooks */ |
1315 | #ifdef CONFIG_KEYS | 1315 | #ifdef CONFIG_KEYS |
1316 | int (*key_alloc)(struct key *key); | 1316 | int (*key_alloc)(struct key *key, struct task_struct *tsk); |
1317 | void (*key_free)(struct key *key); | 1317 | void (*key_free)(struct key *key); |
1318 | int (*key_permission)(key_ref_t key_ref, | 1318 | int (*key_permission)(key_ref_t key_ref, |
1319 | struct task_struct *context, | 1319 | struct task_struct *context, |
@@ -3008,9 +3008,10 @@ static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid | |||
3008 | 3008 | ||
3009 | #ifdef CONFIG_KEYS | 3009 | #ifdef CONFIG_KEYS |
3010 | #ifdef CONFIG_SECURITY | 3010 | #ifdef CONFIG_SECURITY |
3011 | static inline int security_key_alloc(struct key *key) | 3011 | static inline int security_key_alloc(struct key *key, |
3012 | struct task_struct *tsk) | ||
3012 | { | 3013 | { |
3013 | return security_ops->key_alloc(key); | 3014 | return security_ops->key_alloc(key, tsk); |
3014 | } | 3015 | } |
3015 | 3016 | ||
3016 | static inline void security_key_free(struct key *key) | 3017 | static inline void security_key_free(struct key *key) |
@@ -3027,7 +3028,8 @@ static inline int security_key_permission(key_ref_t key_ref, | |||
3027 | 3028 | ||
3028 | #else | 3029 | #else |
3029 | 3030 | ||
3030 | static inline int security_key_alloc(struct key *key) | 3031 | static inline int security_key_alloc(struct key *key, |
3032 | struct task_struct *tsk) | ||
3031 | { | 3033 | { |
3032 | return 0; | 3034 | return 0; |
3033 | } | 3035 | } |
diff --git a/include/linux/zconf.h b/include/linux/zconf.h index f1cfd66b9554..0beb75e38caa 100644 --- a/include/linux/zconf.h +++ b/include/linux/zconf.h | |||
@@ -35,6 +35,18 @@ | |||
35 | # define MAX_WBITS 15 /* 32K LZ77 window */ | 35 | # define MAX_WBITS 15 /* 32K LZ77 window */ |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | /* default windowBits for decompression. MAX_WBITS is for compression only */ | ||
39 | #ifndef DEF_WBITS | ||
40 | # define DEF_WBITS MAX_WBITS | ||
41 | #endif | ||
42 | |||
43 | /* default memLevel */ | ||
44 | #if MAX_MEM_LEVEL >= 8 | ||
45 | # define DEF_MEM_LEVEL 8 | ||
46 | #else | ||
47 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
48 | #endif | ||
49 | |||
38 | /* Type declarations */ | 50 | /* Type declarations */ |
39 | 51 | ||
40 | typedef unsigned char Byte; /* 8 bits */ | 52 | typedef unsigned char Byte; /* 8 bits */ |
diff --git a/include/linux/zlib.h b/include/linux/zlib.h index 4fa32f0d4df8..9e3192a7dc6f 100644 --- a/include/linux/zlib.h +++ b/include/linux/zlib.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library |
2 | version 1.1.3, July 9th, 1998 | ||
3 | 2 | ||
4 | Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler | 3 | Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler |
5 | 4 | ||
6 | This software is provided 'as-is', without any express or implied | 5 | This software is provided 'as-is', without any express or implied |
7 | warranty. In no event will the authors be held liable for any damages | 6 | warranty. In no event will the authors be held liable for any damages |
@@ -24,7 +23,7 @@ | |||
24 | 23 | ||
25 | 24 | ||
26 | The data format used by the zlib library is described by RFCs (Request for | 25 | The data format used by the zlib library is described by RFCs (Request for |
27 | Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt | 26 | Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt |
28 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). | 27 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). |
29 | */ | 28 | */ |
30 | 29 | ||
@@ -33,7 +32,22 @@ | |||
33 | 32 | ||
34 | #include <linux/zconf.h> | 33 | #include <linux/zconf.h> |
35 | 34 | ||
36 | #define ZLIB_VERSION "1.1.3" | 35 | /* zlib deflate based on ZLIB_VERSION "1.1.3" */ |
36 | /* zlib inflate based on ZLIB_VERSION "1.2.3" */ | ||
37 | |||
38 | /* | ||
39 | This is a modified version of zlib for use inside the Linux kernel. | ||
40 | The main changes are to perform all memory allocation in advance. | ||
41 | |||
42 | Inflation Changes: | ||
43 | * Z_PACKET_FLUSH is added and used by ppp_deflate. Before returning | ||
44 | this checks there is no more input data available and the next data | ||
45 | is a STORED block. It also resets the mode to be read for the next | ||
46 | data, all as per PPP requirements. | ||
47 | * Addition of zlib_inflateIncomp which copies incompressible data into | ||
48 | the history window and adjusts the accoutning without calling | ||
49 | zlib_inflate itself to inflate the data. | ||
50 | */ | ||
37 | 51 | ||
38 | /* | 52 | /* |
39 | The 'zlib' compression library provides in-memory compression and | 53 | The 'zlib' compression library provides in-memory compression and |
@@ -48,9 +62,18 @@ | |||
48 | application must provide more input and/or consume the output | 62 | application must provide more input and/or consume the output |
49 | (providing more output space) before each call. | 63 | (providing more output space) before each call. |
50 | 64 | ||
65 | The compressed data format used by default by the in-memory functions is | ||
66 | the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped | ||
67 | around a deflate stream, which is itself documented in RFC 1951. | ||
68 | |||
51 | The library also supports reading and writing files in gzip (.gz) format | 69 | The library also supports reading and writing files in gzip (.gz) format |
52 | with an interface similar to that of stdio. | 70 | with an interface similar to that of stdio. |
53 | 71 | ||
72 | The zlib format was designed to be compact and fast for use in memory | ||
73 | and on communications channels. The gzip format was designed for single- | ||
74 | file compression on file systems, has a larger header than zlib to maintain | ||
75 | directory information, and uses a different, slower check method than zlib. | ||
76 | |||
54 | The library does not install any signal handler. The decoder checks | 77 | The library does not install any signal handler. The decoder checks |
55 | the consistency of the compressed data, so the library should never | 78 | the consistency of the compressed data, so the library should never |
56 | crash even in case of corrupted input. | 79 | crash even in case of corrupted input. |
@@ -119,7 +142,8 @@ typedef z_stream *z_streamp; | |||
119 | #define Z_SYNC_FLUSH 3 | 142 | #define Z_SYNC_FLUSH 3 |
120 | #define Z_FULL_FLUSH 4 | 143 | #define Z_FULL_FLUSH 4 |
121 | #define Z_FINISH 5 | 144 | #define Z_FINISH 5 |
122 | /* Allowed flush values; see deflate() below for details */ | 145 | #define Z_BLOCK 6 /* Only for inflate at present */ |
146 | /* Allowed flush values; see deflate() and inflate() below for details */ | ||
123 | 147 | ||
124 | #define Z_OK 0 | 148 | #define Z_OK 0 |
125 | #define Z_STREAM_END 1 | 149 | #define Z_STREAM_END 1 |
@@ -155,13 +179,6 @@ typedef z_stream *z_streamp; | |||
155 | 179 | ||
156 | /* basic functions */ | 180 | /* basic functions */ |
157 | 181 | ||
158 | extern const char * zlib_zlibVersion (void); | ||
159 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | ||
160 | If the first character differs, the library code actually used is | ||
161 | not compatible with the zlib.h header file used by the application. | ||
162 | This check is automatically made by deflateInit and inflateInit. | ||
163 | */ | ||
164 | |||
165 | extern int zlib_deflate_workspacesize (void); | 182 | extern int zlib_deflate_workspacesize (void); |
166 | /* | 183 | /* |
167 | Returns the number of bytes that needs to be allocated for a per- | 184 | Returns the number of bytes that needs to be allocated for a per- |
@@ -315,9 +332,9 @@ extern int zlib_inflateInit (z_streamp strm); | |||
315 | extern int zlib_inflate (z_streamp strm, int flush); | 332 | extern int zlib_inflate (z_streamp strm, int flush); |
316 | /* | 333 | /* |
317 | inflate decompresses as much data as possible, and stops when the input | 334 | inflate decompresses as much data as possible, and stops when the input |
318 | buffer becomes empty or the output buffer becomes full. It may some | 335 | buffer becomes empty or the output buffer becomes full. It may introduce |
319 | introduce some output latency (reading input without producing any output) | 336 | some output latency (reading input without producing any output) except when |
320 | except when forced to flush. | 337 | forced to flush. |
321 | 338 | ||
322 | The detailed semantics are as follows. inflate performs one or both of the | 339 | The detailed semantics are as follows. inflate performs one or both of the |
323 | following actions: | 340 | following actions: |
@@ -341,11 +358,26 @@ extern int zlib_inflate (z_streamp strm, int flush); | |||
341 | must be called again after making room in the output buffer because there | 358 | must be called again after making room in the output buffer because there |
342 | might be more output pending. | 359 | might be more output pending. |
343 | 360 | ||
344 | If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much | 361 | The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, |
345 | output as possible to the output buffer. The flushing behavior of inflate is | 362 | Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much |
346 | not specified for values of the flush parameter other than Z_SYNC_FLUSH | 363 | output as possible to the output buffer. Z_BLOCK requests that inflate() stop |
347 | and Z_FINISH, but the current implementation actually flushes as much output | 364 | if and when it gets to the next deflate block boundary. When decoding the |
348 | as possible anyway. | 365 | zlib or gzip format, this will cause inflate() to return immediately after |
366 | the header and before the first block. When doing a raw inflate, inflate() | ||
367 | will go ahead and process the first block, and will return when it gets to | ||
368 | the end of that block, or when it runs out of data. | ||
369 | |||
370 | The Z_BLOCK option assists in appending to or combining deflate streams. | ||
371 | Also to assist in this, on return inflate() will set strm->data_type to the | ||
372 | number of unused bits in the last byte taken from strm->next_in, plus 64 | ||
373 | if inflate() is currently decoding the last block in the deflate stream, | ||
374 | plus 128 if inflate() returned immediately after decoding an end-of-block | ||
375 | code or decoding the complete header up to just before the first byte of the | ||
376 | deflate stream. The end-of-block will not be indicated until all of the | ||
377 | uncompressed data from that block has been written to strm->next_out. The | ||
378 | number of unused bits may in general be greater than seven, except when | ||
379 | bit 7 of data_type is set, in which case the number of unused bits will be | ||
380 | less than eight. | ||
349 | 381 | ||
350 | inflate() should normally be called until it returns Z_STREAM_END or an | 382 | inflate() should normally be called until it returns Z_STREAM_END or an |
351 | error. However if all decompression is to be performed in a single step | 383 | error. However if all decompression is to be performed in a single step |
@@ -355,29 +387,44 @@ extern int zlib_inflate (z_streamp strm, int flush); | |||
355 | uncompressed data. (The size of the uncompressed data may have been saved | 387 | uncompressed data. (The size of the uncompressed data may have been saved |
356 | by the compressor for this purpose.) The next operation on this stream must | 388 | by the compressor for this purpose.) The next operation on this stream must |
357 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH | 389 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH |
358 | is never required, but can be used to inform inflate that a faster routine | 390 | is never required, but can be used to inform inflate that a faster approach |
359 | may be used for the single inflate() call. | 391 | may be used for the single inflate() call. |
360 | 392 | ||
361 | If a preset dictionary is needed at this point (see inflateSetDictionary | 393 | In this implementation, inflate() always flushes as much output as |
362 | below), inflate sets strm-adler to the adler32 checksum of the | 394 | possible to the output buffer, and always uses the faster approach on the |
363 | dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise | 395 | first call. So the only effect of the flush parameter in this implementation |
364 | it sets strm->adler to the adler32 checksum of all output produced | 396 | is on the return value of inflate(), as noted below, or when it returns early |
365 | so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or | 397 | because Z_BLOCK is used. |
366 | an error code as described below. At the end of the stream, inflate() | 398 | |
367 | checks that its computed adler32 checksum is equal to that saved by the | 399 | If a preset dictionary is needed after this call (see inflateSetDictionary |
368 | compressor and returns Z_STREAM_END only if the checksum is correct. | 400 | below), inflate sets strm->adler to the adler32 checksum of the dictionary |
401 | chosen by the compressor and returns Z_NEED_DICT; otherwise it sets | ||
402 | strm->adler to the adler32 checksum of all output produced so far (that is, | ||
403 | total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described | ||
404 | below. At the end of the stream, inflate() checks that its computed adler32 | ||
405 | checksum is equal to that saved by the compressor and returns Z_STREAM_END | ||
406 | only if the checksum is correct. | ||
407 | |||
408 | inflate() will decompress and check either zlib-wrapped or gzip-wrapped | ||
409 | deflate data. The header type is detected automatically. Any information | ||
410 | contained in the gzip header is not retained, so applications that need that | ||
411 | information should instead use raw inflate, see inflateInit2() below, or | ||
412 | inflateBack() and perform their own processing of the gzip header and | ||
413 | trailer. | ||
369 | 414 | ||
370 | inflate() returns Z_OK if some progress has been made (more input processed | 415 | inflate() returns Z_OK if some progress has been made (more input processed |
371 | or more output produced), Z_STREAM_END if the end of the compressed data has | 416 | or more output produced), Z_STREAM_END if the end of the compressed data has |
372 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a | 417 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a |
373 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | 418 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was |
374 | corrupted (input stream not conforming to the zlib format or incorrect | 419 | corrupted (input stream not conforming to the zlib format or incorrect check |
375 | adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent | 420 | value), Z_STREAM_ERROR if the stream structure was inconsistent (for example |
376 | (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not | 421 | if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, |
377 | enough memory, Z_BUF_ERROR if no progress is possible or if there was not | 422 | Z_BUF_ERROR if no progress is possible or if there was not enough room in the |
378 | enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR | 423 | output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and |
379 | case, the application may then call inflateSync to look for a good | 424 | inflate() can be called again with more input and more output space to |
380 | compression block. | 425 | continue decompressing. If Z_DATA_ERROR is returned, the application may then |
426 | call inflateSync() to look for a good compression block if a partial recovery | ||
427 | of the data is desired. | ||
381 | */ | 428 | */ |
382 | 429 | ||
383 | 430 | ||
@@ -547,16 +594,36 @@ extern int inflateInit2 (z_streamp strm, int windowBits); | |||
547 | The windowBits parameter is the base two logarithm of the maximum window | 594 | The windowBits parameter is the base two logarithm of the maximum window |
548 | size (the size of the history buffer). It should be in the range 8..15 for | 595 | size (the size of the history buffer). It should be in the range 8..15 for |
549 | this version of the library. The default value is 15 if inflateInit is used | 596 | this version of the library. The default value is 15 if inflateInit is used |
550 | instead. If a compressed stream with a larger window size is given as | 597 | instead. windowBits must be greater than or equal to the windowBits value |
551 | input, inflate() will return with the error code Z_DATA_ERROR instead of | 598 | provided to deflateInit2() while compressing, or it must be equal to 15 if |
552 | trying to allocate a larger window. | 599 | deflateInit2() was not used. If a compressed stream with a larger window |
553 | 600 | size is given as input, inflate() will return with the error code | |
554 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | 601 | Z_DATA_ERROR instead of trying to allocate a larger window. |
555 | memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative | 602 | |
556 | memLevel). msg is set to null if there is no error message. inflateInit2 | 603 | windowBits can also be -8..-15 for raw inflate. In this case, -windowBits |
557 | does not perform any decompression apart from reading the zlib header if | 604 | determines the window size. inflate() will then process raw deflate data, |
558 | present: this will be done by inflate(). (So next_in and avail_in may be | 605 | not looking for a zlib or gzip header, not generating a check value, and not |
559 | modified, but next_out and avail_out are unchanged.) | 606 | looking for any check values for comparison at the end of the stream. This |
607 | is for use with other formats that use the deflate compressed data format | ||
608 | such as zip. Those formats provide their own check values. If a custom | ||
609 | format is developed using the raw deflate format for compressed data, it is | ||
610 | recommended that a check value such as an adler32 or a crc32 be applied to | ||
611 | the uncompressed data as is done in the zlib, gzip, and zip formats. For | ||
612 | most applications, the zlib format should be used as is. Note that comments | ||
613 | above on the use in deflateInit2() applies to the magnitude of windowBits. | ||
614 | |||
615 | windowBits can also be greater than 15 for optional gzip decoding. Add | ||
616 | 32 to windowBits to enable zlib and gzip decoding with automatic header | ||
617 | detection, or add 16 to decode only the gzip format (the zlib format will | ||
618 | return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is | ||
619 | a crc32 instead of an adler32. | ||
620 | |||
621 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
622 | memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg | ||
623 | is set to null if there is no error message. inflateInit2 does not perform | ||
624 | any decompression apart from reading the zlib header if present: this will | ||
625 | be done by inflate(). (So next_in and avail_in may be modified, but next_out | ||
626 | and avail_out are unchanged.) | ||
560 | */ | 627 | */ |
561 | 628 | ||
562 | extern int zlib_inflateSetDictionary (z_streamp strm, | 629 | extern int zlib_inflateSetDictionary (z_streamp strm, |
@@ -564,16 +631,19 @@ extern int zlib_inflateSetDictionary (z_streamp strm, | |||
564 | uInt dictLength); | 631 | uInt dictLength); |
565 | /* | 632 | /* |
566 | Initializes the decompression dictionary from the given uncompressed byte | 633 | Initializes the decompression dictionary from the given uncompressed byte |
567 | sequence. This function must be called immediately after a call of inflate | 634 | sequence. This function must be called immediately after a call of inflate, |
568 | if this call returned Z_NEED_DICT. The dictionary chosen by the compressor | 635 | if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
569 | can be determined from the Adler32 value returned by this call of | 636 | can be determined from the adler32 value returned by that call of inflate. |
570 | inflate. The compressor and decompressor must use exactly the same | 637 | The compressor and decompressor must use exactly the same dictionary (see |
571 | dictionary (see deflateSetDictionary). | 638 | deflateSetDictionary). For raw inflate, this function can be called |
639 | immediately after inflateInit2() or inflateReset() and before any call of | ||
640 | inflate() to set the dictionary. The application must insure that the | ||
641 | dictionary that was used for compression is provided. | ||
572 | 642 | ||
573 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | 643 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
574 | parameter is invalid (such as NULL dictionary) or the stream state is | 644 | parameter is invalid (such as NULL dictionary) or the stream state is |
575 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | 645 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
576 | expected one (incorrect Adler32 value). inflateSetDictionary does not | 646 | expected one (incorrect adler32 value). inflateSetDictionary does not |
577 | perform any decompression: this will be done by subsequent calls of | 647 | perform any decompression: this will be done by subsequent calls of |
578 | inflate(). | 648 | inflate(). |
579 | */ | 649 | */ |
@@ -614,40 +684,19 @@ extern int zlib_inflateIncomp (z_stream *strm); | |||
614 | containing the data at next_in (except that the data is not output). | 684 | containing the data at next_in (except that the data is not output). |
615 | */ | 685 | */ |
616 | 686 | ||
617 | /* various hacks, don't look :) */ | ||
618 | |||
619 | /* deflateInit and inflateInit are macros to allow checking the zlib version | ||
620 | * and the compiler's view of z_stream: | ||
621 | */ | ||
622 | extern int zlib_deflateInit_ (z_streamp strm, int level, | ||
623 | const char *version, int stream_size); | ||
624 | extern int zlib_inflateInit_ (z_streamp strm, | ||
625 | const char *version, int stream_size); | ||
626 | extern int zlib_deflateInit2_ (z_streamp strm, int level, int method, | ||
627 | int windowBits, int memLevel, | ||
628 | int strategy, const char *version, | ||
629 | int stream_size); | ||
630 | extern int zlib_inflateInit2_ (z_streamp strm, int windowBits, | ||
631 | const char *version, int stream_size); | ||
632 | #define zlib_deflateInit(strm, level) \ | 687 | #define zlib_deflateInit(strm, level) \ |
633 | zlib_deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | 688 | zlib_deflateInit2((strm), (level), Z_DEFLATED, MAX_WBITS, \ |
689 | DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY) | ||
634 | #define zlib_inflateInit(strm) \ | 690 | #define zlib_inflateInit(strm) \ |
635 | zlib_inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) | 691 | zlib_inflateInit2((strm), DEF_WBITS) |
636 | #define zlib_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | ||
637 | zlib_deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | ||
638 | (strategy), ZLIB_VERSION, sizeof(z_stream)) | ||
639 | #define zlib_inflateInit2(strm, windowBits) \ | ||
640 | zlib_inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) | ||
641 | 692 | ||
693 | extern int zlib_deflateInit2(z_streamp strm, int level, int method, | ||
694 | int windowBits, int memLevel, | ||
695 | int strategy); | ||
696 | extern int zlib_inflateInit2(z_streamp strm, int windowBits); | ||
642 | 697 | ||
643 | #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) | 698 | #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) |
644 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | 699 | struct internal_state {int dummy;}; /* hack for buggy compilers */ |
645 | #endif | 700 | #endif |
646 | 701 | ||
647 | extern const char * zlib_zError (int err); | ||
648 | #if 0 | ||
649 | extern int zlib_inflateSyncPoint (z_streamp z); | ||
650 | #endif | ||
651 | extern const uLong * zlib_get_crc_table (void); | ||
652 | |||
653 | #endif /* _ZLIB_H */ | 702 | #endif /* _ZLIB_H */ |
diff --git a/include/linux/zutil.h b/include/linux/zutil.h index ee0c59cf2136..6adfa9a6ffe9 100644 --- a/include/linux/zutil.h +++ b/include/linux/zutil.h | |||
@@ -23,18 +23,6 @@ typedef unsigned long ulg; | |||
23 | 23 | ||
24 | /* common constants */ | 24 | /* common constants */ |
25 | 25 | ||
26 | #ifndef DEF_WBITS | ||
27 | # define DEF_WBITS MAX_WBITS | ||
28 | #endif | ||
29 | /* default windowBits for decompression. MAX_WBITS is for compression only */ | ||
30 | |||
31 | #if MAX_MEM_LEVEL >= 8 | ||
32 | # define DEF_MEM_LEVEL 8 | ||
33 | #else | ||
34 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
35 | #endif | ||
36 | /* default memLevel */ | ||
37 | |||
38 | #define STORED_BLOCK 0 | 26 | #define STORED_BLOCK 0 |
39 | #define STATIC_TREES 1 | 27 | #define STATIC_TREES 1 |
40 | #define DYN_TREES 2 | 28 | #define DYN_TREES 2 |