diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 18:09:23 -0400 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 18:09:23 -0400 |
| commit | c514720716c7b109ff980f8b3cb93f9af872c91c (patch) | |
| tree | 490a9578995705de69712893a190b67651bddc56 /include/linux | |
| parent | 07929dcb963786512c760dd3ecd148d89295e7e5 (diff) | |
| parent | 1e279dd855d15b72364b4103f872d67d8592647e (diff) | |
Automatic merge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'include/linux')
58 files changed, 1998 insertions, 1380 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ef8483673aa3..f85cbe919e13 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -206,7 +206,10 @@ struct acpi_table_plat_int_src { | |||
| 206 | u8 eid; | 206 | u8 eid; |
| 207 | u8 iosapic_vector; | 207 | u8 iosapic_vector; |
| 208 | u32 global_irq; | 208 | u32 global_irq; |
| 209 | u32 reserved; | 209 | struct { |
| 210 | u32 cpei_override_flag:1; | ||
| 211 | u32 reserved:31; | ||
| 212 | } plint_flags; | ||
| 210 | } __attribute__ ((packed)); | 213 | } __attribute__ ((packed)); |
| 211 | 214 | ||
| 212 | enum acpi_interrupt_id { | 215 | enum acpi_interrupt_id { |
| @@ -475,7 +478,7 @@ struct acpi_prt_list { | |||
| 475 | struct pci_dev; | 478 | struct pci_dev; |
| 476 | 479 | ||
| 477 | int acpi_pci_irq_enable (struct pci_dev *dev); | 480 | int acpi_pci_irq_enable (struct pci_dev *dev); |
| 478 | void acpi_penalize_isa_irq(int irq); | 481 | void acpi_penalize_isa_irq(int irq, int active); |
| 479 | 482 | ||
| 480 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | 483 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ |
| 481 | void acpi_pci_irq_disable (struct pci_dev *dev); | 484 | void acpi_pci_irq_disable (struct pci_dev *dev); |
diff --git a/include/linux/audit.h b/include/linux/audit.h index bf2ad3ba72eb..68aba0c02e49 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -165,7 +165,7 @@ | |||
| 165 | #define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) | 165 | #define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) |
| 166 | #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 166 | #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
| 167 | #define AUDIT_ARCH_SPARC (EM_SPARC) | 167 | #define AUDIT_ARCH_SPARC (EM_SPARC) |
| 168 | #define AUDIT_ARCH_SPARC64 (EM_SPARC64|__AUDIT_ARCH_64BIT) | 168 | #define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) |
| 169 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) | 169 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) |
| 170 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 170 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
| 171 | 171 | ||
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 802c91e9b3da..90828493791f 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
| @@ -19,6 +19,9 @@ enum bh_state_bits { | |||
| 19 | BH_Dirty, /* Is dirty */ | 19 | BH_Dirty, /* Is dirty */ |
| 20 | BH_Lock, /* Is locked */ | 20 | BH_Lock, /* Is locked */ |
| 21 | BH_Req, /* Has been submitted for I/O */ | 21 | BH_Req, /* Has been submitted for I/O */ |
| 22 | BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise | ||
| 23 | * IO completion of other buffers in the page | ||
| 24 | */ | ||
| 22 | 25 | ||
| 23 | BH_Mapped, /* Has a disk mapping */ | 26 | BH_Mapped, /* Has a disk mapping */ |
| 24 | BH_New, /* Disk mapping was newly created by get_block */ | 27 | BH_New, /* Disk mapping was newly created by get_block */ |
diff --git a/include/linux/cache.h b/include/linux/cache.h index 4d767b93738a..f6b5a46c5f82 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h | |||
| @@ -13,6 +13,12 @@ | |||
| 13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES | 13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES |
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| 16 | #if defined(CONFIG_X86) || defined(CONFIG_SPARC64) | ||
| 17 | #define __read_mostly __attribute__((__section__(".data.read_mostly"))) | ||
| 18 | #else | ||
| 19 | #define __read_mostly | ||
| 20 | #endif | ||
| 21 | |||
| 16 | #ifndef ____cacheline_aligned | 22 | #ifndef ____cacheline_aligned |
| 17 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) | 23 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) |
| 18 | #endif | 24 | #endif |
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index 70a4ebb5d964..ecb0d39c0798 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h | |||
| @@ -346,10 +346,27 @@ COMPATIBLE_IOCTL(PPPOEIOCDFWD) | |||
| 346 | /* LP */ | 346 | /* LP */ |
| 347 | COMPATIBLE_IOCTL(LPGETSTATUS) | 347 | COMPATIBLE_IOCTL(LPGETSTATUS) |
| 348 | /* ppdev */ | 348 | /* ppdev */ |
| 349 | COMPATIBLE_IOCTL(PPSETMODE) | ||
| 350 | COMPATIBLE_IOCTL(PPRSTATUS) | ||
| 351 | COMPATIBLE_IOCTL(PPRCONTROL) | ||
| 352 | COMPATIBLE_IOCTL(PPWCONTROL) | ||
| 353 | COMPATIBLE_IOCTL(PPFCONTROL) | ||
| 354 | COMPATIBLE_IOCTL(PPRDATA) | ||
| 355 | COMPATIBLE_IOCTL(PPWDATA) | ||
| 349 | COMPATIBLE_IOCTL(PPCLAIM) | 356 | COMPATIBLE_IOCTL(PPCLAIM) |
| 350 | COMPATIBLE_IOCTL(PPRELEASE) | 357 | COMPATIBLE_IOCTL(PPRELEASE) |
| 351 | COMPATIBLE_IOCTL(PPEXCL) | ||
| 352 | COMPATIBLE_IOCTL(PPYIELD) | 358 | COMPATIBLE_IOCTL(PPYIELD) |
| 359 | COMPATIBLE_IOCTL(PPEXCL) | ||
| 360 | COMPATIBLE_IOCTL(PPDATADIR) | ||
| 361 | COMPATIBLE_IOCTL(PPNEGOT) | ||
| 362 | COMPATIBLE_IOCTL(PPWCTLONIRQ) | ||
| 363 | COMPATIBLE_IOCTL(PPCLRIRQ) | ||
| 364 | COMPATIBLE_IOCTL(PPSETPHASE) | ||
| 365 | COMPATIBLE_IOCTL(PPGETMODES) | ||
| 366 | COMPATIBLE_IOCTL(PPGETMODE) | ||
| 367 | COMPATIBLE_IOCTL(PPGETPHASE) | ||
| 368 | COMPATIBLE_IOCTL(PPGETFLAGS) | ||
| 369 | COMPATIBLE_IOCTL(PPSETFLAGS) | ||
| 353 | /* CDROM stuff */ | 370 | /* CDROM stuff */ |
| 354 | COMPATIBLE_IOCTL(CDROMPAUSE) | 371 | COMPATIBLE_IOCTL(CDROMPAUSE) |
| 355 | COMPATIBLE_IOCTL(CDROMRESUME) | 372 | COMPATIBLE_IOCTL(CDROMRESUME) |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 927daa86c9b3..ff7f80f48df1 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -201,7 +201,7 @@ struct cpufreq_driver { | |||
| 201 | 201 | ||
| 202 | /* optional */ | 202 | /* optional */ |
| 203 | int (*exit) (struct cpufreq_policy *policy); | 203 | int (*exit) (struct cpufreq_policy *policy); |
| 204 | int (*suspend) (struct cpufreq_policy *policy, u32 state); | 204 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
| 205 | int (*resume) (struct cpufreq_policy *policy); | 205 | int (*resume) (struct cpufreq_policy *policy); |
| 206 | struct freq_attr **attr; | 206 | struct freq_attr **attr; |
| 207 | }; | 207 | }; |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 387da6a3e58c..5e2bcc636a02 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -61,6 +61,15 @@ | |||
| 61 | #define CRYPTO_DIR_DECRYPT 0 | 61 | #define CRYPTO_DIR_DECRYPT 0 |
| 62 | 62 | ||
| 63 | struct scatterlist; | 63 | struct scatterlist; |
| 64 | struct crypto_tfm; | ||
| 65 | |||
| 66 | struct cipher_desc { | ||
| 67 | struct crypto_tfm *tfm; | ||
| 68 | void (*crfn)(void *ctx, u8 *dst, const u8 *src); | ||
| 69 | unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, | ||
| 70 | const u8 *src, unsigned int nbytes); | ||
| 71 | void *info; | ||
| 72 | }; | ||
| 64 | 73 | ||
| 65 | /* | 74 | /* |
| 66 | * Algorithms: modular crypto algorithm implementations, managed | 75 | * Algorithms: modular crypto algorithm implementations, managed |
| @@ -73,6 +82,19 @@ struct cipher_alg { | |||
| 73 | unsigned int keylen, u32 *flags); | 82 | unsigned int keylen, u32 *flags); |
| 74 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); | 83 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); |
| 75 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); | 84 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); |
| 85 | |||
| 86 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, | ||
| 87 | u8 *dst, const u8 *src, | ||
| 88 | unsigned int nbytes); | ||
| 89 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, | ||
| 90 | u8 *dst, const u8 *src, | ||
| 91 | unsigned int nbytes); | ||
| 92 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, | ||
| 93 | u8 *dst, const u8 *src, | ||
| 94 | unsigned int nbytes); | ||
| 95 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, | ||
| 96 | u8 *dst, const u8 *src, | ||
| 97 | unsigned int nbytes); | ||
| 76 | }; | 98 | }; |
| 77 | 99 | ||
| 78 | struct digest_alg { | 100 | struct digest_alg { |
| @@ -102,6 +124,7 @@ struct crypto_alg { | |||
| 102 | u32 cra_flags; | 124 | u32 cra_flags; |
| 103 | unsigned int cra_blocksize; | 125 | unsigned int cra_blocksize; |
| 104 | unsigned int cra_ctxsize; | 126 | unsigned int cra_ctxsize; |
| 127 | unsigned int cra_alignmask; | ||
| 105 | const char cra_name[CRYPTO_MAX_ALG_NAME]; | 128 | const char cra_name[CRYPTO_MAX_ALG_NAME]; |
| 106 | 129 | ||
| 107 | union { | 130 | union { |
| @@ -136,7 +159,6 @@ static inline int crypto_alg_available(const char *name, u32 flags) | |||
| 136 | * and core processing logic. Managed via crypto_alloc_tfm() and | 159 | * and core processing logic. Managed via crypto_alloc_tfm() and |
| 137 | * crypto_free_tfm(), as well as the various helpers below. | 160 | * crypto_free_tfm(), as well as the various helpers below. |
| 138 | */ | 161 | */ |
| 139 | struct crypto_tfm; | ||
| 140 | 162 | ||
| 141 | struct cipher_tfm { | 163 | struct cipher_tfm { |
| 142 | void *cit_iv; | 164 | void *cit_iv; |
| @@ -266,6 +288,16 @@ static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) | |||
| 266 | return tfm->__crt_alg->cra_digest.dia_digestsize; | 288 | return tfm->__crt_alg->cra_digest.dia_digestsize; |
| 267 | } | 289 | } |
| 268 | 290 | ||
| 291 | static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) | ||
| 292 | { | ||
| 293 | return tfm->__crt_alg->cra_alignmask; | ||
| 294 | } | ||
| 295 | |||
| 296 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | ||
| 297 | { | ||
| 298 | return (void *)&tfm[1]; | ||
| 299 | } | ||
| 300 | |||
| 269 | /* | 301 | /* |
| 270 | * API wrappers. | 302 | * API wrappers. |
| 271 | */ | 303 | */ |
diff --git a/include/linux/device.h b/include/linux/device.h index f378c846e6d5..06e5d42f2c7b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -284,8 +284,10 @@ struct device { | |||
| 284 | struct device_driver *driver; /* which driver has allocated this | 284 | struct device_driver *driver; /* which driver has allocated this |
| 285 | device */ | 285 | device */ |
| 286 | void *driver_data; /* data private to the driver */ | 286 | void *driver_data; /* data private to the driver */ |
| 287 | void *platform_data; /* Platform specific data (e.g. ACPI, | 287 | void *platform_data; /* Platform specific data, device |
| 288 | BIOS data relevant to device) */ | 288 | core doesn't touch it */ |
| 289 | void *firmware_data; /* Firmware specific data (e.g. ACPI, | ||
| 290 | BIOS data),reserved for device core*/ | ||
| 289 | struct dev_pm_info power; | 291 | struct dev_pm_info power; |
| 290 | 292 | ||
| 291 | u64 *dma_mask; /* dma mask (if dma'able device) */ | 293 | u64 *dma_mask; /* dma mask (if dma'able device) */ |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index cf3847edc50f..ce8518e658b6 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -33,7 +33,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev, | |||
| 33 | unsigned short type, void *daddr, | 33 | unsigned short type, void *daddr, |
| 34 | void *saddr, unsigned len); | 34 | void *saddr, unsigned len); |
| 35 | extern int eth_rebuild_header(struct sk_buff *skb); | 35 | extern int eth_rebuild_header(struct sk_buff *skb); |
| 36 | extern unsigned short eth_type_trans(struct sk_buff *skb, struct net_device *dev); | 36 | extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); |
| 37 | extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, | 37 | extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, |
| 38 | unsigned char * haddr); | 38 | unsigned char * haddr); |
| 39 | extern int eth_header_cache(struct neighbour *neigh, | 39 | extern int eth_header_cache(struct neighbour *neigh, |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 4b6e1ab216a5..c16662836c58 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
| @@ -239,6 +239,20 @@ struct ext3_new_group_data { | |||
| 239 | #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) | 239 | #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) |
| 240 | 240 | ||
| 241 | /* | 241 | /* |
| 242 | * Mount options | ||
| 243 | */ | ||
| 244 | struct ext3_mount_options { | ||
| 245 | unsigned long s_mount_opt; | ||
| 246 | uid_t s_resuid; | ||
| 247 | gid_t s_resgid; | ||
| 248 | unsigned long s_commit_interval; | ||
| 249 | #ifdef CONFIG_QUOTA | ||
| 250 | int s_jquota_fmt; | ||
| 251 | char *s_qf_names[MAXQUOTAS]; | ||
| 252 | #endif | ||
| 253 | }; | ||
| 254 | |||
| 255 | /* | ||
| 242 | * Structure of an inode on the disk | 256 | * Structure of an inode on the disk |
| 243 | */ | 257 | */ |
| 244 | struct ext3_inode { | 258 | struct ext3_inode { |
diff --git a/include/linux/fadvise.h b/include/linux/fadvise.h index 6fc656dfb93d..e8e747139b9a 100644 --- a/include/linux/fadvise.h +++ b/include/linux/fadvise.h | |||
| @@ -5,7 +5,17 @@ | |||
| 5 | #define POSIX_FADV_RANDOM 1 /* Expect random page references. */ | 5 | #define POSIX_FADV_RANDOM 1 /* Expect random page references. */ |
| 6 | #define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ | 6 | #define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ |
| 7 | #define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ | 7 | #define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ |
| 8 | |||
| 9 | /* | ||
| 10 | * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE | ||
| 11 | * for s390-64 differ from the values for the rest of the world. | ||
| 12 | */ | ||
| 13 | #if defined(__s390x__) | ||
| 14 | #define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ | ||
| 15 | #define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ | ||
| 16 | #else | ||
| 8 | #define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ | 17 | #define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ |
| 9 | #define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ | 18 | #define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ |
| 19 | #endif | ||
| 10 | 20 | ||
| 11 | #endif /* FADVISE_H_INCLUDED */ | 21 | #endif /* FADVISE_H_INCLUDED */ |
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h index 002f6367697d..e61e42dfd317 100644 --- a/include/linux/fddidevice.h +++ b/include/linux/fddidevice.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/if_fddi.h> | 25 | #include <linux/if_fddi.h> |
| 26 | 26 | ||
| 27 | #ifdef __KERNEL__ | 27 | #ifdef __KERNEL__ |
| 28 | extern unsigned short fddi_type_trans(struct sk_buff *skb, | 28 | extern __be16 fddi_type_trans(struct sk_buff *skb, |
| 29 | struct net_device *dev); | 29 | struct net_device *dev); |
| 30 | extern struct net_device *alloc_fddidev(int sizeof_priv); | 30 | extern struct net_device *alloc_fddidev(int sizeof_priv); |
| 31 | #endif | 31 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 047bde30836a..0f53e0124941 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -474,6 +474,11 @@ struct inode { | |||
| 474 | struct dnotify_struct *i_dnotify; /* for directory notifications */ | 474 | struct dnotify_struct *i_dnotify; /* for directory notifications */ |
| 475 | #endif | 475 | #endif |
| 476 | 476 | ||
| 477 | #ifdef CONFIG_INOTIFY | ||
| 478 | struct list_head inotify_watches; /* watches on this inode */ | ||
| 479 | struct semaphore inotify_sem; /* protects the watches list */ | ||
| 480 | #endif | ||
| 481 | |||
| 477 | unsigned long i_state; | 482 | unsigned long i_state; |
| 478 | unsigned long dirtied_when; /* jiffies of first dirtying */ | 483 | unsigned long dirtied_when; /* jiffies of first dirtying */ |
| 479 | 484 | ||
| @@ -1393,7 +1398,6 @@ extern void emergency_remount(void); | |||
| 1393 | extern int do_remount_sb(struct super_block *sb, int flags, | 1398 | extern int do_remount_sb(struct super_block *sb, int flags, |
| 1394 | void *data, int force); | 1399 | void *data, int force); |
| 1395 | extern sector_t bmap(struct inode *, sector_t); | 1400 | extern sector_t bmap(struct inode *, sector_t); |
| 1396 | extern int setattr_mask(unsigned int); | ||
| 1397 | extern int notify_change(struct dentry *, struct iattr *); | 1401 | extern int notify_change(struct dentry *, struct iattr *); |
| 1398 | extern int permission(struct inode *, int, struct nameidata *); | 1402 | extern int permission(struct inode *, int, struct nameidata *); |
| 1399 | extern int generic_permission(struct inode *, int, | 1403 | extern int generic_permission(struct inode *, int, |
| @@ -1435,7 +1439,11 @@ extern struct inode * igrab(struct inode *); | |||
| 1435 | extern ino_t iunique(struct super_block *, ino_t); | 1439 | extern ino_t iunique(struct super_block *, ino_t); |
| 1436 | extern int inode_needs_sync(struct inode *inode); | 1440 | extern int inode_needs_sync(struct inode *inode); |
| 1437 | extern void generic_delete_inode(struct inode *inode); | 1441 | extern void generic_delete_inode(struct inode *inode); |
| 1442 | extern void generic_drop_inode(struct inode *inode); | ||
| 1438 | 1443 | ||
| 1444 | extern struct inode *ilookup5_nowait(struct super_block *sb, | ||
| 1445 | unsigned long hashval, int (*test)(struct inode *, void *), | ||
| 1446 | void *data); | ||
| 1439 | extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, | 1447 | extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, |
| 1440 | int (*test)(struct inode *, void *), void *data); | 1448 | int (*test)(struct inode *, void *), void *data); |
| 1441 | extern struct inode *ilookup(struct super_block *sb, unsigned long ino); | 1449 | extern struct inode *ilookup(struct super_block *sb, unsigned long ino); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h new file mode 100644 index 000000000000..d07a92c94776 --- /dev/null +++ b/include/linux/fsnotify.h | |||
| @@ -0,0 +1,248 @@ | |||
| 1 | #ifndef _LINUX_FS_NOTIFY_H | ||
| 2 | #define _LINUX_FS_NOTIFY_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * include/linux/fsnotify.h - generic hooks for filesystem notification, to | ||
| 6 | * reduce in-source duplication from both dnotify and inotify. | ||
| 7 | * | ||
| 8 | * We don't compile any of this away in some complicated menagerie of ifdefs. | ||
| 9 | * Instead, we rely on the code inside to optimize away as needed. | ||
| 10 | * | ||
| 11 | * (C) Copyright 2005 Robert Love | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifdef __KERNEL__ | ||
| 15 | |||
| 16 | #include <linux/dnotify.h> | ||
| 17 | #include <linux/inotify.h> | ||
| 18 | |||
| 19 | /* | ||
| 20 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir | ||
| 21 | */ | ||
| 22 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | ||
| 23 | const char *old_name, const char *new_name, | ||
| 24 | int isdir) | ||
| 25 | { | ||
| 26 | u32 cookie = inotify_get_cookie(); | ||
| 27 | |||
| 28 | if (old_dir == new_dir) | ||
| 29 | inode_dir_notify(old_dir, DN_RENAME); | ||
| 30 | else { | ||
| 31 | inode_dir_notify(old_dir, DN_DELETE); | ||
| 32 | inode_dir_notify(new_dir, DN_CREATE); | ||
| 33 | } | ||
| 34 | |||
| 35 | if (isdir) | ||
| 36 | isdir = IN_ISDIR; | ||
| 37 | inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name); | ||
| 38 | inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name); | ||
| 39 | } | ||
| 40 | |||
| 41 | /* | ||
| 42 | * fsnotify_unlink - file was unlinked | ||
| 43 | */ | ||
| 44 | static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir) | ||
| 45 | { | ||
| 46 | struct inode *inode = dentry->d_inode; | ||
| 47 | |||
| 48 | inode_dir_notify(dir, DN_DELETE); | ||
| 49 | inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name); | ||
| 50 | inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); | ||
| 51 | |||
| 52 | inotify_inode_is_dead(inode); | ||
| 53 | } | ||
| 54 | |||
| 55 | /* | ||
| 56 | * fsnotify_rmdir - directory was removed | ||
| 57 | */ | ||
| 58 | static inline void fsnotify_rmdir(struct dentry *dentry, struct inode *inode, | ||
| 59 | struct inode *dir) | ||
| 60 | { | ||
| 61 | inode_dir_notify(dir, DN_DELETE); | ||
| 62 | inotify_inode_queue_event(dir,IN_DELETE|IN_ISDIR,0,dentry->d_name.name); | ||
| 63 | inotify_inode_queue_event(inode, IN_DELETE_SELF | IN_ISDIR, 0, NULL); | ||
| 64 | inotify_inode_is_dead(inode); | ||
| 65 | } | ||
| 66 | |||
| 67 | /* | ||
| 68 | * fsnotify_create - 'name' was linked in | ||
| 69 | */ | ||
| 70 | static inline void fsnotify_create(struct inode *inode, const char *name) | ||
| 71 | { | ||
| 72 | inode_dir_notify(inode, DN_CREATE); | ||
| 73 | inotify_inode_queue_event(inode, IN_CREATE, 0, name); | ||
| 74 | } | ||
| 75 | |||
| 76 | /* | ||
| 77 | * fsnotify_mkdir - directory 'name' was created | ||
| 78 | */ | ||
| 79 | static inline void fsnotify_mkdir(struct inode *inode, const char *name) | ||
| 80 | { | ||
| 81 | inode_dir_notify(inode, DN_CREATE); | ||
| 82 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); | ||
| 83 | } | ||
| 84 | |||
| 85 | /* | ||
| 86 | * fsnotify_access - file was read | ||
| 87 | */ | ||
| 88 | static inline void fsnotify_access(struct dentry *dentry) | ||
| 89 | { | ||
| 90 | struct inode *inode = dentry->d_inode; | ||
| 91 | u32 mask = IN_ACCESS; | ||
| 92 | |||
| 93 | if (S_ISDIR(inode->i_mode)) | ||
| 94 | mask |= IN_ISDIR; | ||
| 95 | |||
| 96 | dnotify_parent(dentry, DN_ACCESS); | ||
| 97 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 98 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 99 | } | ||
| 100 | |||
| 101 | /* | ||
| 102 | * fsnotify_modify - file was modified | ||
| 103 | */ | ||
| 104 | static inline void fsnotify_modify(struct dentry *dentry) | ||
| 105 | { | ||
| 106 | struct inode *inode = dentry->d_inode; | ||
| 107 | u32 mask = IN_MODIFY; | ||
| 108 | |||
| 109 | if (S_ISDIR(inode->i_mode)) | ||
| 110 | mask |= IN_ISDIR; | ||
| 111 | |||
| 112 | dnotify_parent(dentry, DN_MODIFY); | ||
| 113 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 114 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 115 | } | ||
| 116 | |||
| 117 | /* | ||
| 118 | * fsnotify_open - file was opened | ||
| 119 | */ | ||
| 120 | static inline void fsnotify_open(struct dentry *dentry) | ||
| 121 | { | ||
| 122 | struct inode *inode = dentry->d_inode; | ||
| 123 | u32 mask = IN_OPEN; | ||
| 124 | |||
| 125 | if (S_ISDIR(inode->i_mode)) | ||
| 126 | mask |= IN_ISDIR; | ||
| 127 | |||
| 128 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 129 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 130 | } | ||
| 131 | |||
| 132 | /* | ||
| 133 | * fsnotify_close - file was closed | ||
| 134 | */ | ||
| 135 | static inline void fsnotify_close(struct file *file) | ||
| 136 | { | ||
| 137 | struct dentry *dentry = file->f_dentry; | ||
| 138 | struct inode *inode = dentry->d_inode; | ||
| 139 | const char *name = dentry->d_name.name; | ||
| 140 | mode_t mode = file->f_mode; | ||
| 141 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; | ||
| 142 | |||
| 143 | if (S_ISDIR(inode->i_mode)) | ||
| 144 | mask |= IN_ISDIR; | ||
| 145 | |||
| 146 | inotify_dentry_parent_queue_event(dentry, mask, 0, name); | ||
| 147 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 148 | } | ||
| 149 | |||
| 150 | /* | ||
| 151 | * fsnotify_xattr - extended attributes were changed | ||
| 152 | */ | ||
| 153 | static inline void fsnotify_xattr(struct dentry *dentry) | ||
| 154 | { | ||
| 155 | struct inode *inode = dentry->d_inode; | ||
| 156 | u32 mask = IN_ATTRIB; | ||
| 157 | |||
| 158 | if (S_ISDIR(inode->i_mode)) | ||
| 159 | mask |= IN_ISDIR; | ||
| 160 | |||
| 161 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 162 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 163 | } | ||
| 164 | |||
| 165 | /* | ||
| 166 | * fsnotify_change - notify_change event. file was modified and/or metadata | ||
| 167 | * was changed. | ||
| 168 | */ | ||
| 169 | static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) | ||
| 170 | { | ||
| 171 | struct inode *inode = dentry->d_inode; | ||
| 172 | int dn_mask = 0; | ||
| 173 | u32 in_mask = 0; | ||
| 174 | |||
| 175 | if (ia_valid & ATTR_UID) { | ||
| 176 | in_mask |= IN_ATTRIB; | ||
| 177 | dn_mask |= DN_ATTRIB; | ||
| 178 | } | ||
| 179 | if (ia_valid & ATTR_GID) { | ||
| 180 | in_mask |= IN_ATTRIB; | ||
| 181 | dn_mask |= DN_ATTRIB; | ||
| 182 | } | ||
| 183 | if (ia_valid & ATTR_SIZE) { | ||
| 184 | in_mask |= IN_MODIFY; | ||
| 185 | dn_mask |= DN_MODIFY; | ||
| 186 | } | ||
| 187 | /* both times implies a utime(s) call */ | ||
| 188 | if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) | ||
| 189 | { | ||
| 190 | in_mask |= IN_ATTRIB; | ||
| 191 | dn_mask |= DN_ATTRIB; | ||
| 192 | } else if (ia_valid & ATTR_ATIME) { | ||
| 193 | in_mask |= IN_ACCESS; | ||
| 194 | dn_mask |= DN_ACCESS; | ||
| 195 | } else if (ia_valid & ATTR_MTIME) { | ||
| 196 | in_mask |= IN_MODIFY; | ||
| 197 | dn_mask |= DN_MODIFY; | ||
| 198 | } | ||
| 199 | if (ia_valid & ATTR_MODE) { | ||
| 200 | in_mask |= IN_ATTRIB; | ||
| 201 | dn_mask |= DN_ATTRIB; | ||
| 202 | } | ||
| 203 | |||
| 204 | if (dn_mask) | ||
| 205 | dnotify_parent(dentry, dn_mask); | ||
| 206 | if (in_mask) { | ||
| 207 | if (S_ISDIR(inode->i_mode)) | ||
| 208 | in_mask |= IN_ISDIR; | ||
| 209 | inotify_inode_queue_event(inode, in_mask, 0, NULL); | ||
| 210 | inotify_dentry_parent_queue_event(dentry, in_mask, 0, | ||
| 211 | dentry->d_name.name); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 215 | #ifdef CONFIG_INOTIFY /* inotify helpers */ | ||
| 216 | |||
| 217 | /* | ||
| 218 | * fsnotify_oldname_init - save off the old filename before we change it | ||
| 219 | */ | ||
| 220 | static inline const char *fsnotify_oldname_init(const char *name) | ||
| 221 | { | ||
| 222 | return kstrdup(name, GFP_KERNEL); | ||
| 223 | } | ||
| 224 | |||
| 225 | /* | ||
| 226 | * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init | ||
| 227 | */ | ||
| 228 | static inline void fsnotify_oldname_free(const char *old_name) | ||
| 229 | { | ||
| 230 | kfree(old_name); | ||
| 231 | } | ||
| 232 | |||
| 233 | #else /* CONFIG_INOTIFY */ | ||
| 234 | |||
| 235 | static inline const char *fsnotify_oldname_init(const char *name) | ||
| 236 | { | ||
| 237 | return NULL; | ||
| 238 | } | ||
| 239 | |||
| 240 | static inline void fsnotify_oldname_free(const char *old_name) | ||
| 241 | { | ||
| 242 | } | ||
| 243 | |||
| 244 | #endif /* ! CONFIG_INOTIFY */ | ||
| 245 | |||
| 246 | #endif /* __KERNEL__ */ | ||
| 247 | |||
| 248 | #endif /* _LINUX_FS_NOTIFY_H */ | ||
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 8d6bf608b199..7c7400137e97 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -12,8 +12,8 @@ struct vm_area_struct; | |||
| 12 | * GFP bitmasks.. | 12 | * GFP bitmasks.. |
| 13 | */ | 13 | */ |
| 14 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ | 14 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ |
| 15 | #define __GFP_DMA 0x01 | 15 | #define __GFP_DMA 0x01u |
| 16 | #define __GFP_HIGHMEM 0x02 | 16 | #define __GFP_HIGHMEM 0x02u |
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| 19 | * Action modifiers - doesn't change the zoning | 19 | * Action modifiers - doesn't change the zoning |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 8336dba18971..5912874ca83c 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define LINUX_HARDIRQ_H | 2 | #define LINUX_HARDIRQ_H |
| 3 | 3 | ||
| 4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
| 5 | #include <linux/preempt.h> | ||
| 5 | #include <linux/smp_lock.h> | 6 | #include <linux/smp_lock.h> |
| 6 | #include <asm/hardirq.h> | 7 | #include <asm/hardirq.h> |
| 7 | #include <asm/system.h> | 8 | #include <asm/system.h> |
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index ed2927ef1ff7..df695e9ae327 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
| @@ -242,8 +242,8 @@ static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) | |||
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | 244 | ||
| 245 | static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb, | 245 | static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, |
| 246 | struct net_device *dev) | 246 | struct net_device *dev) |
| 247 | { | 247 | { |
| 248 | hdlc_device *hdlc = dev_to_hdlc(dev); | 248 | hdlc_device *hdlc = dev_to_hdlc(dev); |
| 249 | 249 | ||
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 004e6f09a6e2..68c896a36a34 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h | |||
| @@ -23,7 +23,7 @@ struct shaper | |||
| 23 | __u32 shapeclock; | 23 | __u32 shapeclock; |
| 24 | unsigned long recovery; /* Time we can next clock a packet out on | 24 | unsigned long recovery; /* Time we can next clock a packet out on |
| 25 | an empty queue */ | 25 | an empty queue */ |
| 26 | struct semaphore sem; | 26 | spinlock_t lock; |
| 27 | struct net_device_stats stats; | 27 | struct net_device_stats stats; |
| 28 | struct net_device *dev; | 28 | struct net_device *dev; |
| 29 | int (*hard_start_xmit) (struct sk_buff *skb, | 29 | int (*hard_start_xmit) (struct sk_buff *skb, |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 390e760a96d3..0c31ef0b5bad 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
| @@ -148,7 +148,6 @@ struct ip_sf_socklist | |||
| 148 | struct ip_mc_socklist | 148 | struct ip_mc_socklist |
| 149 | { | 149 | { |
| 150 | struct ip_mc_socklist *next; | 150 | struct ip_mc_socklist *next; |
| 151 | int count; | ||
| 152 | struct ip_mreqn multi; | 151 | struct ip_mreqn multi; |
| 153 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ | 152 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ |
| 154 | struct ip_sf_socklist *sflist; | 153 | struct ip_sf_socklist *sflist; |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h new file mode 100644 index 000000000000..a40c2bf0408e --- /dev/null +++ b/include/linux/inotify.h | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | /* | ||
| 2 | * Inode based directory notification for Linux | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005 John McCutchan | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _LINUX_INOTIFY_H | ||
| 8 | #define _LINUX_INOTIFY_H | ||
| 9 | |||
| 10 | #include <linux/types.h> | ||
| 11 | |||
| 12 | /* | ||
| 13 | * struct inotify_event - structure read from the inotify device for each event | ||
| 14 | * | ||
| 15 | * When you are watching a directory, you will receive the filename for events | ||
| 16 | * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. | ||
| 17 | */ | ||
| 18 | struct inotify_event { | ||
| 19 | __s32 wd; /* watch descriptor */ | ||
| 20 | __u32 mask; /* watch mask */ | ||
| 21 | __u32 cookie; /* cookie to synchronize two events */ | ||
| 22 | __u32 len; /* length (including nulls) of name */ | ||
| 23 | char name[0]; /* stub for possible name */ | ||
| 24 | }; | ||
| 25 | |||
| 26 | /* the following are legal, implemented events that user-space can watch for */ | ||
| 27 | #define IN_ACCESS 0x00000001 /* File was accessed */ | ||
| 28 | #define IN_MODIFY 0x00000002 /* File was modified */ | ||
| 29 | #define IN_ATTRIB 0x00000004 /* Metadata changed */ | ||
| 30 | #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ | ||
| 31 | #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ | ||
| 32 | #define IN_OPEN 0x00000020 /* File was opened */ | ||
| 33 | #define IN_MOVED_FROM 0x00000040 /* File was moved from X */ | ||
| 34 | #define IN_MOVED_TO 0x00000080 /* File was moved to Y */ | ||
| 35 | #define IN_CREATE 0x00000100 /* Subfile was created */ | ||
| 36 | #define IN_DELETE 0x00000200 /* Subfile was deleted */ | ||
| 37 | #define IN_DELETE_SELF 0x00000400 /* Self was deleted */ | ||
| 38 | |||
| 39 | /* the following are legal events. they are sent as needed to any watch */ | ||
| 40 | #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ | ||
| 41 | #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ | ||
| 42 | #define IN_IGNORED 0x00008000 /* File was ignored */ | ||
| 43 | |||
| 44 | /* helper events */ | ||
| 45 | #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ | ||
| 46 | #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ | ||
| 47 | |||
| 48 | /* special flags */ | ||
| 49 | #define IN_ISDIR 0x40000000 /* event occurred against dir */ | ||
| 50 | #define IN_ONESHOT 0x80000000 /* only send event once */ | ||
| 51 | |||
| 52 | /* | ||
| 53 | * All of the events - we build the list by hand so that we can add flags in | ||
| 54 | * the future and not break backward compatibility. Apps will get only the | ||
| 55 | * events that they originally wanted. Be sure to add new events here! | ||
| 56 | */ | ||
| 57 | #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ | ||
| 58 | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ | ||
| 59 | IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF) | ||
| 60 | |||
| 61 | #ifdef __KERNEL__ | ||
| 62 | |||
| 63 | #include <linux/dcache.h> | ||
| 64 | #include <linux/fs.h> | ||
| 65 | #include <linux/config.h> | ||
| 66 | |||
| 67 | #ifdef CONFIG_INOTIFY | ||
| 68 | |||
| 69 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | ||
| 70 | const char *); | ||
| 71 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | ||
| 72 | const char *); | ||
| 73 | extern void inotify_unmount_inodes(struct list_head *); | ||
| 74 | extern void inotify_inode_is_dead(struct inode *); | ||
| 75 | extern u32 inotify_get_cookie(void); | ||
| 76 | |||
| 77 | #else | ||
| 78 | |||
| 79 | static inline void inotify_inode_queue_event(struct inode *inode, | ||
| 80 | __u32 mask, __u32 cookie, | ||
| 81 | const char *filename) | ||
| 82 | { | ||
| 83 | } | ||
| 84 | |||
| 85 | static inline void inotify_dentry_parent_queue_event(struct dentry *dentry, | ||
| 86 | __u32 mask, __u32 cookie, | ||
| 87 | const char *filename) | ||
| 88 | { | ||
| 89 | } | ||
| 90 | |||
| 91 | static inline void inotify_unmount_inodes(struct list_head *list) | ||
| 92 | { | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline void inotify_inode_is_dead(struct inode *inode) | ||
| 96 | { | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline u32 inotify_get_cookie(void) | ||
| 100 | { | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | |||
| 104 | #endif /* CONFIG_INOTIFY */ | ||
| 105 | |||
| 106 | #endif /* __KERNEL __ */ | ||
| 107 | |||
| 108 | #endif /* _LINUX_INOTIFY_H */ | ||
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 8a453a0b5e4b..88d5961f7a3f 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h | |||
| @@ -34,9 +34,6 @@ enum { | |||
| 34 | */ | 34 | */ |
| 35 | #define IOPRIO_BE_NR (8) | 35 | #define IOPRIO_BE_NR (8) |
| 36 | 36 | ||
| 37 | asmlinkage int sys_ioprio_set(int, int, int); | ||
| 38 | asmlinkage int sys_ioprio_get(int, int); | ||
| 39 | |||
| 40 | enum { | 37 | enum { |
| 41 | IOPRIO_WHO_PROCESS = 1, | 38 | IOPRIO_WHO_PROCESS = 1, |
| 42 | IOPRIO_WHO_PGRP, | 39 | IOPRIO_WHO_PGRP, |
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h index 4afc8d8c2e9e..1e21546622de 100644 --- a/include/linux/jffs2_fs_sb.h +++ b/include/linux/jffs2_fs_sb.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $Id: jffs2_fs_sb.h,v 1.48 2004/11/20 10:41:12 dwmw2 Exp $ */ | 1 | /* $Id: jffs2_fs_sb.h,v 1.52 2005/05/19 16:12:17 gleixner Exp $ */ |
| 2 | 2 | ||
| 3 | #ifndef _JFFS2_FS_SB | 3 | #ifndef _JFFS2_FS_SB |
| 4 | #define _JFFS2_FS_SB | 4 | #define _JFFS2_FS_SB |
| @@ -14,7 +14,8 @@ | |||
| 14 | #include <linux/rwsem.h> | 14 | #include <linux/rwsem.h> |
| 15 | 15 | ||
| 16 | #define JFFS2_SB_FLAG_RO 1 | 16 | #define JFFS2_SB_FLAG_RO 1 |
| 17 | #define JFFS2_SB_FLAG_MOUNTING 2 | 17 | #define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */ |
| 18 | #define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */ | ||
| 18 | 19 | ||
| 19 | struct jffs2_inodirty; | 20 | struct jffs2_inodirty; |
| 20 | 21 | ||
| @@ -31,7 +32,7 @@ struct jffs2_sb_info { | |||
| 31 | unsigned int flags; | 32 | unsigned int flags; |
| 32 | 33 | ||
| 33 | struct task_struct *gc_task; /* GC task struct */ | 34 | struct task_struct *gc_task; /* GC task struct */ |
| 34 | struct semaphore gc_thread_start; /* GC thread start mutex */ | 35 | struct completion gc_thread_start; /* GC thread start completion */ |
| 35 | struct completion gc_thread_exit; /* GC thread exit completion port */ | 36 | struct completion gc_thread_exit; /* GC thread exit completion port */ |
| 36 | 37 | ||
| 37 | struct semaphore alloc_sem; /* Used to protect all the following | 38 | struct semaphore alloc_sem; /* Used to protect all the following |
| @@ -94,7 +95,7 @@ struct jffs2_sb_info { | |||
| 94 | to an obsoleted node. I don't like this. Alternatives welcomed. */ | 95 | to an obsoleted node. I don't like this. Alternatives welcomed. */ |
| 95 | struct semaphore erase_free_sem; | 96 | struct semaphore erase_free_sem; |
| 96 | 97 | ||
| 97 | #if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC | 98 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
| 98 | /* Write-behind buffer for NAND flash */ | 99 | /* Write-behind buffer for NAND flash */ |
| 99 | unsigned char *wbuf; | 100 | unsigned char *wbuf; |
| 100 | uint32_t wbuf_ofs; | 101 | uint32_t wbuf_ofs; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index b7a194c4362a..e050fc2d4c26 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -155,7 +155,7 @@ extern void arch_copy_kprobe(struct kprobe *p); | |||
| 155 | extern void arch_arm_kprobe(struct kprobe *p); | 155 | extern void arch_arm_kprobe(struct kprobe *p); |
| 156 | extern void arch_disarm_kprobe(struct kprobe *p); | 156 | extern void arch_disarm_kprobe(struct kprobe *p); |
| 157 | extern void arch_remove_kprobe(struct kprobe *p); | 157 | extern void arch_remove_kprobe(struct kprobe *p); |
| 158 | extern int arch_init(void); | 158 | extern int arch_init_kprobes(void); |
| 159 | extern void show_registers(struct pt_regs *regs); | 159 | extern void show_registers(struct pt_regs *regs); |
| 160 | extern kprobe_opcode_t *get_insn_slot(void); | 160 | extern kprobe_opcode_t *get_insn_slot(void); |
| 161 | extern void free_insn_slot(kprobe_opcode_t *slot); | 161 | extern void free_insn_slot(kprobe_opcode_t *slot); |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 9b6d05172ed4..dce53ac1625d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -174,6 +174,17 @@ struct serio_device_id { | |||
| 174 | __u8 proto; | 174 | __u8 proto; |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | /* | ||
| 178 | * Struct used for matching a device | ||
| 179 | */ | ||
| 180 | struct of_device_id | ||
| 181 | { | ||
| 182 | char name[32]; | ||
| 183 | char type[32]; | ||
| 184 | char compatible[128]; | ||
| 185 | void *data; | ||
| 186 | }; | ||
| 187 | |||
| 177 | 188 | ||
| 178 | /* PCMCIA */ | 189 | /* PCMCIA */ |
| 179 | 190 | ||
diff --git a/include/linux/mount.h b/include/linux/mount.h index 8b8d3b9beefd..f8f39937e301 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define _LINUX_MOUNT_H | 12 | #define _LINUX_MOUNT_H |
| 13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
| 14 | 14 | ||
| 15 | #include <linux/types.h> | ||
| 15 | #include <linux/list.h> | 16 | #include <linux/list.h> |
| 16 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 17 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
| @@ -34,7 +35,7 @@ struct vfsmount | |||
| 34 | int mnt_expiry_mark; /* true if marked for expiry */ | 35 | int mnt_expiry_mark; /* true if marked for expiry */ |
| 35 | char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ | 36 | char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ |
| 36 | struct list_head mnt_list; | 37 | struct list_head mnt_list; |
| 37 | struct list_head mnt_fslink; /* link in fs-specific expiry list */ | 38 | struct list_head mnt_expire; /* link in fs-specific expiry list */ |
| 38 | struct namespace *mnt_namespace; /* containing namespace */ | 39 | struct namespace *mnt_namespace; /* containing namespace */ |
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| @@ -47,7 +48,7 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt) | |||
| 47 | 48 | ||
| 48 | extern void __mntput(struct vfsmount *mnt); | 49 | extern void __mntput(struct vfsmount *mnt); |
| 49 | 50 | ||
| 50 | static inline void _mntput(struct vfsmount *mnt) | 51 | static inline void mntput_no_expire(struct vfsmount *mnt) |
| 51 | { | 52 | { |
| 52 | if (mnt) { | 53 | if (mnt) { |
| 53 | if (atomic_dec_and_test(&mnt->mnt_count)) | 54 | if (atomic_dec_and_test(&mnt->mnt_count)) |
| @@ -59,7 +60,7 @@ static inline void mntput(struct vfsmount *mnt) | |||
| 59 | { | 60 | { |
| 60 | if (mnt) { | 61 | if (mnt) { |
| 61 | mnt->mnt_expiry_mark = 0; | 62 | mnt->mnt_expiry_mark = 0; |
| 62 | _mntput(mnt); | 63 | mntput_no_expire(mnt); |
| 63 | } | 64 | } |
| 64 | } | 65 | } |
| 65 | 66 | ||
| @@ -76,6 +77,7 @@ extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, | |||
| 76 | extern void mark_mounts_for_expiry(struct list_head *mounts); | 77 | extern void mark_mounts_for_expiry(struct list_head *mounts); |
| 77 | 78 | ||
| 78 | extern spinlock_t vfsmount_lock; | 79 | extern spinlock_t vfsmount_lock; |
| 80 | extern dev_t name_to_dev_t(char *name); | ||
| 79 | 81 | ||
| 80 | #endif | 82 | #endif |
| 81 | #endif /* _LINUX_MOUNT_H */ | 83 | #endif /* _LINUX_MOUNT_H */ |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 2ed8c585021e..e6b6a1c66bd5 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
| 3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
| 4 | * $Id: cfi.h,v 1.50 2004/11/20 12:46:51 dwmw2 Exp $ | 4 | * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
| @@ -148,6 +148,14 @@ struct cfi_pri_intelext { | |||
| 148 | uint8_t extra[0]; | 148 | uint8_t extra[0]; |
| 149 | } __attribute__((packed)); | 149 | } __attribute__((packed)); |
| 150 | 150 | ||
| 151 | struct cfi_intelext_otpinfo { | ||
| 152 | uint32_t ProtRegAddr; | ||
| 153 | uint16_t FactGroups; | ||
| 154 | uint8_t FactProtRegSize; | ||
| 155 | uint16_t UserGroups; | ||
| 156 | uint8_t UserProtRegSize; | ||
| 157 | } __attribute__((packed)); | ||
| 158 | |||
| 151 | struct cfi_intelext_blockinfo { | 159 | struct cfi_intelext_blockinfo { |
| 152 | uint16_t NumIdentBlocks; | 160 | uint16_t NumIdentBlocks; |
| 153 | uint16_t BlockSize; | 161 | uint16_t BlockSize; |
| @@ -244,7 +252,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int | |||
| 244 | * It looks too long to be inline, but in the common case it should almost all | 252 | * It looks too long to be inline, but in the common case it should almost all |
| 245 | * get optimised away. | 253 | * get optimised away. |
| 246 | */ | 254 | */ |
| 247 | static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cfi_private *cfi) | 255 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) |
| 248 | { | 256 | { |
| 249 | map_word val = { {0} }; | 257 | map_word val = { {0} }; |
| 250 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | 258 | int wordwidth, words_per_bus, chip_mode, chips_per_word; |
| @@ -307,6 +315,69 @@ static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cf | |||
| 307 | } | 315 | } |
| 308 | #define CMD(x) cfi_build_cmd((x), map, cfi) | 316 | #define CMD(x) cfi_build_cmd((x), map, cfi) |
| 309 | 317 | ||
| 318 | |||
| 319 | static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | ||
| 320 | struct cfi_private *cfi) | ||
| 321 | { | ||
| 322 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | ||
| 323 | unsigned long onestat, res = 0; | ||
| 324 | int i; | ||
| 325 | |||
| 326 | /* We do it this way to give the compiler a fighting chance | ||
| 327 | of optimising away all the crap for 'bankwidth' larger than | ||
| 328 | an unsigned long, in the common case where that support is | ||
| 329 | disabled */ | ||
| 330 | if (map_bankwidth_is_large(map)) { | ||
| 331 | wordwidth = sizeof(unsigned long); | ||
| 332 | words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1 | ||
| 333 | } else { | ||
| 334 | wordwidth = map_bankwidth(map); | ||
| 335 | words_per_bus = 1; | ||
| 336 | } | ||
| 337 | |||
| 338 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | ||
| 339 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | ||
| 340 | |||
| 341 | onestat = val.x[0]; | ||
| 342 | /* Or all status words together */ | ||
| 343 | for (i=1; i < words_per_bus; i++) { | ||
| 344 | onestat |= val.x[i]; | ||
| 345 | } | ||
| 346 | |||
| 347 | res = onestat; | ||
| 348 | switch(chips_per_word) { | ||
| 349 | default: BUG(); | ||
| 350 | #if BITS_PER_LONG >= 64 | ||
| 351 | case 8: | ||
| 352 | res |= (onestat >> (chip_mode * 32)); | ||
| 353 | #endif | ||
| 354 | case 4: | ||
| 355 | res |= (onestat >> (chip_mode * 16)); | ||
| 356 | case 2: | ||
| 357 | res |= (onestat >> (chip_mode * 8)); | ||
| 358 | case 1: | ||
| 359 | ; | ||
| 360 | } | ||
| 361 | |||
| 362 | /* Last, determine what the bit-pattern should be for a single | ||
| 363 | device, according to chip mode and endianness... */ | ||
| 364 | switch (chip_mode) { | ||
| 365 | case 1: | ||
| 366 | break; | ||
| 367 | case 2: | ||
| 368 | res = cfi16_to_cpu(res); | ||
| 369 | break; | ||
| 370 | case 4: | ||
| 371 | res = cfi32_to_cpu(res); | ||
| 372 | break; | ||
| 373 | default: BUG(); | ||
| 374 | } | ||
| 375 | return res; | ||
| 376 | } | ||
| 377 | |||
| 378 | #define MERGESTATUS(x) cfi_merge_status((x), map, cfi) | ||
| 379 | |||
| 380 | |||
| 310 | /* | 381 | /* |
| 311 | * Sends a CFI command to a bank of flash for the given geometry. | 382 | * Sends a CFI command to a bank of flash for the given geometry. |
| 312 | * | 383 | * |
| @@ -357,16 +428,6 @@ static inline void cfi_udelay(int us) | |||
| 357 | } | 428 | } |
| 358 | } | 429 | } |
| 359 | 430 | ||
| 360 | static inline void cfi_spin_lock(spinlock_t *mutex) | ||
| 361 | { | ||
| 362 | spin_lock_bh(mutex); | ||
| 363 | } | ||
| 364 | |||
| 365 | static inline void cfi_spin_unlock(spinlock_t *mutex) | ||
| 366 | { | ||
| 367 | spin_unlock_bh(mutex); | ||
| 368 | } | ||
| 369 | |||
| 370 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, | 431 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, |
| 371 | const char* name); | 432 | const char* name); |
| 372 | struct cfi_fixup { | 433 | struct cfi_fixup { |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index c66ba812bf90..675776fa3e27 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * | 6 | * |
| 7 | * (C) 2000 Red Hat. GPLd. | 7 | * (C) 2000 Red Hat. GPLd. |
| 8 | * | 8 | * |
| 9 | * $Id: flashchip.h,v 1.15 2004/11/05 22:41:06 nico Exp $ | 9 | * $Id: flashchip.h,v 1.17 2005/03/14 18:27:15 bjd Exp $ |
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| @@ -29,6 +29,7 @@ typedef enum { | |||
| 29 | FL_ERASE_SUSPENDED, | 29 | FL_ERASE_SUSPENDED, |
| 30 | FL_WRITING, | 30 | FL_WRITING, |
| 31 | FL_WRITING_TO_BUFFER, | 31 | FL_WRITING_TO_BUFFER, |
| 32 | FL_OTP_WRITE, | ||
| 32 | FL_WRITE_SUSPENDING, | 33 | FL_WRITE_SUSPENDING, |
| 33 | FL_WRITE_SUSPENDED, | 34 | FL_WRITE_SUSPENDED, |
| 34 | FL_PM_SUSPENDED, | 35 | FL_PM_SUSPENDED, |
| @@ -62,8 +63,8 @@ struct flchip { | |||
| 62 | flstate_t state; | 63 | flstate_t state; |
| 63 | flstate_t oldstate; | 64 | flstate_t oldstate; |
| 64 | 65 | ||
| 65 | int write_suspended:1; | 66 | unsigned int write_suspended:1; |
| 66 | int erase_suspended:1; | 67 | unsigned int erase_suspended:1; |
| 67 | unsigned long in_progress_block_addr; | 68 | unsigned long in_progress_block_addr; |
| 68 | 69 | ||
| 69 | spinlock_t *mutex; | 70 | spinlock_t *mutex; |
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index b52c8cbd235c..0268125a6271 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) | 4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) |
| 5 | * | 5 | * |
| 6 | * $Id: inftl.h,v 1.6 2004/06/30 14:49:00 dbrown Exp $ | 6 | * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $ |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #ifndef __MTD_INFTL_H__ | 9 | #ifndef __MTD_INFTL_H__ |
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <mtd/inftl-user.h> | 20 | #include <mtd/inftl-user.h> |
| 21 | 21 | ||
| 22 | #ifndef INFTL_MAJOR | 22 | #ifndef INFTL_MAJOR |
| 23 | #define INFTL_MAJOR 94 | 23 | #define INFTL_MAJOR 96 |
| 24 | #endif | 24 | #endif |
| 25 | #define INFTL_PARTN_BITS 4 | 25 | #define INFTL_PARTN_BITS 4 |
| 26 | 26 | ||
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index f0268b99c900..142963f01d29 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | /* Overhauled routines for dealing with different mmap regions of flash */ | 2 | /* Overhauled routines for dealing with different mmap regions of flash */ |
| 3 | /* $Id: map.h,v 1.46 2005/01/05 17:09:44 dwmw2 Exp $ */ | 3 | /* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */ |
| 4 | 4 | ||
| 5 | #ifndef __LINUX_MTD_MAP_H__ | 5 | #ifndef __LINUX_MTD_MAP_H__ |
| 6 | #define __LINUX_MTD_MAP_H__ | 6 | #define __LINUX_MTD_MAP_H__ |
| @@ -263,6 +263,17 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor | |||
| 263 | return r; | 263 | return r; |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2) | ||
| 267 | { | ||
| 268 | map_word r; | ||
| 269 | int i; | ||
| 270 | |||
| 271 | for (i=0; i<map_words(map); i++) { | ||
| 272 | r.x[i] = val1.x[i] & ~val2.x[i]; | ||
| 273 | } | ||
| 274 | return r; | ||
| 275 | } | ||
| 276 | |||
| 266 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) | 277 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) |
| 267 | { | 278 | { |
| 268 | map_word r; | 279 | map_word r; |
| @@ -273,6 +284,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word | |||
| 273 | } | 284 | } |
| 274 | return r; | 285 | return r; |
| 275 | } | 286 | } |
| 287 | |||
| 276 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) | 288 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) |
| 277 | 289 | ||
| 278 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) | 290 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) |
| @@ -328,16 +340,27 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig | |||
| 328 | return orig; | 340 | return orig; |
| 329 | } | 341 | } |
| 330 | 342 | ||
| 343 | #if BITS_PER_LONG < 64 | ||
| 344 | #define MAP_FF_LIMIT 4 | ||
| 345 | #else | ||
| 346 | #define MAP_FF_LIMIT 8 | ||
| 347 | #endif | ||
| 348 | |||
| 331 | static inline map_word map_word_ff(struct map_info *map) | 349 | static inline map_word map_word_ff(struct map_info *map) |
| 332 | { | 350 | { |
| 333 | map_word r; | 351 | map_word r; |
| 334 | int i; | 352 | int i; |
| 335 | 353 | ||
| 336 | for (i=0; i<map_words(map); i++) { | 354 | if (map_bankwidth(map) < MAP_FF_LIMIT) { |
| 337 | r.x[i] = ~0UL; | 355 | int bw = 8 * map_bankwidth(map); |
| 356 | r.x[0] = (1 << bw) - 1; | ||
| 357 | } else { | ||
| 358 | for (i=0; i<map_words(map); i++) | ||
| 359 | r.x[i] = ~0UL; | ||
| 338 | } | 360 | } |
| 339 | return r; | 361 | return r; |
| 340 | } | 362 | } |
| 363 | |||
| 341 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) | 364 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) |
| 342 | { | 365 | { |
| 343 | map_word r; | 366 | map_word r; |
| @@ -405,7 +428,7 @@ extern void simple_map_init(struct map_info *); | |||
| 405 | 428 | ||
| 406 | 429 | ||
| 407 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) | 430 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) |
| 408 | #define map_is_linear(map) (1) | 431 | #define map_is_linear(map) ({ (void)(map); 1; }) |
| 409 | 432 | ||
| 410 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ | 433 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ |
| 411 | 434 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index b3d134392b31..c50c3f3927d9 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $ | 2 | * $Id: mtd.h,v 1.59 2005/04/11 10:19:02 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. | 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. |
| 5 | * | 5 | * |
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/uio.h> | 20 | #include <linux/uio.h> |
| 21 | #include <linux/notifier.h> | ||
| 21 | 22 | ||
| 22 | #include <linux/mtd/compatmac.h> | 23 | #include <linux/mtd/compatmac.h> |
| 23 | #include <mtd/mtd-abi.h> | 24 | #include <mtd/mtd-abi.h> |
| @@ -69,7 +70,6 @@ struct mtd_info { | |||
| 69 | 70 | ||
| 70 | u_int32_t oobblock; // Size of OOB blocks (e.g. 512) | 71 | u_int32_t oobblock; // Size of OOB blocks (e.g. 512) |
| 71 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) | 72 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) |
| 72 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | ||
| 73 | u_int32_t ecctype; | 73 | u_int32_t ecctype; |
| 74 | u_int32_t eccsize; | 74 | u_int32_t eccsize; |
| 75 | 75 | ||
| @@ -80,6 +80,7 @@ struct mtd_info { | |||
| 80 | 80 | ||
| 81 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) | 81 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) |
| 82 | struct nand_oobinfo oobinfo; | 82 | struct nand_oobinfo oobinfo; |
| 83 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | ||
| 83 | 84 | ||
| 84 | /* Data for variable erase regions. If numeraseregions is zero, | 85 | /* Data for variable erase regions. If numeraseregions is zero, |
| 85 | * it means that the whole device has erasesize as given above. | 86 | * it means that the whole device has erasesize as given above. |
| @@ -113,12 +114,12 @@ struct mtd_info { | |||
| 113 | * flash devices. The user data is one time programmable but the | 114 | * flash devices. The user data is one time programmable but the |
| 114 | * factory data is read only. | 115 | * factory data is read only. |
| 115 | */ | 116 | */ |
| 116 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 117 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); |
| 117 | |||
| 118 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 118 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 119 | 119 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | |
| 120 | /* This function is not yet implemented */ | 120 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 121 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 121 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 122 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); | ||
| 122 | 123 | ||
| 123 | /* kvec-based read/write methods. We need these especially for NAND flash, | 124 | /* kvec-based read/write methods. We need these especially for NAND flash, |
| 124 | with its limited number of write cycles per erase. | 125 | with its limited number of write cycles per erase. |
| @@ -147,6 +148,8 @@ struct mtd_info { | |||
| 147 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | 148 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); |
| 148 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); | 149 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); |
| 149 | 150 | ||
| 151 | struct notifier_block reboot_notifier; /* default mode before reboot */ | ||
| 152 | |||
| 150 | void *priv; | 153 | void *priv; |
| 151 | 154 | ||
| 152 | struct module *owner; | 155 | struct module *owner; |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 9a19c65abd74..9b5b76217584 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
| 6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
| 7 | * | 7 | * |
| 8 | * $Id: nand.h,v 1.68 2004/11/12 10:40:37 gleixner Exp $ | 8 | * $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $ |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -48,6 +48,10 @@ | |||
| 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities | 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities |
| 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id | 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id |
| 50 | * update of nand_chip structure description | 50 | * update of nand_chip structure description |
| 51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option | ||
| 52 | * for BBT_AUTO_REFRESH. | ||
| 53 | * 01-20-2005 dmarlin added optional pointer to hardware specific callback for | ||
| 54 | * extra error status checks. | ||
| 51 | */ | 55 | */ |
| 52 | #ifndef __LINUX_MTD_NAND_H | 56 | #ifndef __LINUX_MTD_NAND_H |
| 53 | #define __LINUX_MTD_NAND_H | 57 | #define __LINUX_MTD_NAND_H |
| @@ -115,6 +119,25 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 115 | #define NAND_CMD_READSTART 0x30 | 119 | #define NAND_CMD_READSTART 0x30 |
| 116 | #define NAND_CMD_CACHEDPROG 0x15 | 120 | #define NAND_CMD_CACHEDPROG 0x15 |
| 117 | 121 | ||
| 122 | /* Extended commands for AG-AND device */ | ||
| 123 | /* | ||
| 124 | * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but | ||
| 125 | * there is no way to distinguish that from NAND_CMD_READ0 | ||
| 126 | * until the remaining sequence of commands has been completed | ||
| 127 | * so add a high order bit and mask it off in the command. | ||
| 128 | */ | ||
| 129 | #define NAND_CMD_DEPLETE1 0x100 | ||
| 130 | #define NAND_CMD_DEPLETE2 0x38 | ||
| 131 | #define NAND_CMD_STATUS_MULTI 0x71 | ||
| 132 | #define NAND_CMD_STATUS_ERROR 0x72 | ||
| 133 | /* multi-bank error status (banks 0-3) */ | ||
| 134 | #define NAND_CMD_STATUS_ERROR0 0x73 | ||
| 135 | #define NAND_CMD_STATUS_ERROR1 0x74 | ||
| 136 | #define NAND_CMD_STATUS_ERROR2 0x75 | ||
| 137 | #define NAND_CMD_STATUS_ERROR3 0x76 | ||
| 138 | #define NAND_CMD_STATUS_RESET 0x7f | ||
| 139 | #define NAND_CMD_STATUS_CLEAR 0xff | ||
| 140 | |||
| 118 | /* Status bits */ | 141 | /* Status bits */ |
| 119 | #define NAND_STATUS_FAIL 0x01 | 142 | #define NAND_STATUS_FAIL 0x01 |
| 120 | #define NAND_STATUS_FAIL_N1 0x02 | 143 | #define NAND_STATUS_FAIL_N1 0x02 |
| @@ -143,7 +166,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 143 | 166 | ||
| 144 | /* | 167 | /* |
| 145 | * Constants for Hardware ECC | 168 | * Constants for Hardware ECC |
| 146 | */ | 169 | */ |
| 147 | /* Reset Hardware ECC for read */ | 170 | /* Reset Hardware ECC for read */ |
| 148 | #define NAND_ECC_READ 0 | 171 | #define NAND_ECC_READ 0 |
| 149 | /* Reset Hardware ECC for write */ | 172 | /* Reset Hardware ECC for write */ |
| @@ -151,6 +174,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 151 | /* Enable Hardware ECC before syndrom is read back from flash */ | 174 | /* Enable Hardware ECC before syndrom is read back from flash */ |
| 152 | #define NAND_ECC_READSYN 2 | 175 | #define NAND_ECC_READSYN 2 |
| 153 | 176 | ||
| 177 | /* Bit mask for flags passed to do_nand_read_ecc */ | ||
| 178 | #define NAND_GET_DEVICE 0x80 | ||
| 179 | |||
| 180 | |||
| 154 | /* Option constants for bizarre disfunctionality and real | 181 | /* Option constants for bizarre disfunctionality and real |
| 155 | * features | 182 | * features |
| 156 | */ | 183 | */ |
| @@ -170,6 +197,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 170 | /* Chip has a array of 4 pages which can be read without | 197 | /* Chip has a array of 4 pages which can be read without |
| 171 | * additional ready /busy waits */ | 198 | * additional ready /busy waits */ |
| 172 | #define NAND_4PAGE_ARRAY 0x00000040 | 199 | #define NAND_4PAGE_ARRAY 0x00000040 |
| 200 | /* Chip requires that BBT is periodically rewritten to prevent | ||
| 201 | * bits from adjacent blocks from 'leaking' in altering data. | ||
| 202 | * This happens with the Renesas AG-AND chips, possibly others. */ | ||
| 203 | #define BBT_AUTO_REFRESH 0x00000080 | ||
| 173 | 204 | ||
| 174 | /* Options valid for Samsung large page devices */ | 205 | /* Options valid for Samsung large page devices */ |
| 175 | #define NAND_SAMSUNG_LP_OPTIONS \ | 206 | #define NAND_SAMSUNG_LP_OPTIONS \ |
| @@ -192,7 +223,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 192 | * This can only work if we have the ecc bytes directly behind the | 223 | * This can only work if we have the ecc bytes directly behind the |
| 193 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ | 224 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ |
| 194 | #define NAND_HWECC_SYNDROME 0x00020000 | 225 | #define NAND_HWECC_SYNDROME 0x00020000 |
| 195 | 226 | /* This option skips the bbt scan during initialization. */ | |
| 227 | #define NAND_SKIP_BBTSCAN 0x00040000 | ||
| 196 | 228 | ||
| 197 | /* Options set by nand scan */ | 229 | /* Options set by nand scan */ |
| 198 | /* Nand scan has allocated oob_buf */ | 230 | /* Nand scan has allocated oob_buf */ |
| @@ -221,10 +253,13 @@ struct nand_chip; | |||
| 221 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices | 253 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices |
| 222 | * @lock: protection lock | 254 | * @lock: protection lock |
| 223 | * @active: the mtd device which holds the controller currently | 255 | * @active: the mtd device which holds the controller currently |
| 256 | * @wq: wait queue to sleep on if a NAND operation is in progress | ||
| 257 | * used instead of the per chip wait queue when a hw controller is available | ||
| 224 | */ | 258 | */ |
| 225 | struct nand_hw_control { | 259 | struct nand_hw_control { |
| 226 | spinlock_t lock; | 260 | spinlock_t lock; |
| 227 | struct nand_chip *active; | 261 | struct nand_chip *active; |
| 262 | wait_queue_head_t wq; | ||
| 228 | }; | 263 | }; |
| 229 | 264 | ||
| 230 | /** | 265 | /** |
| @@ -283,6 +318,8 @@ struct nand_hw_control { | |||
| 283 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan | 318 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan |
| 284 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices | 319 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices |
| 285 | * @priv: [OPTIONAL] pointer to private chip date | 320 | * @priv: [OPTIONAL] pointer to private chip date |
| 321 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | ||
| 322 | * (determine if errors are correctable) | ||
| 286 | */ | 323 | */ |
| 287 | 324 | ||
| 288 | struct nand_chip { | 325 | struct nand_chip { |
| @@ -338,6 +375,7 @@ struct nand_chip { | |||
| 338 | struct nand_bbt_descr *badblock_pattern; | 375 | struct nand_bbt_descr *badblock_pattern; |
| 339 | struct nand_hw_control *controller; | 376 | struct nand_hw_control *controller; |
| 340 | void *priv; | 377 | void *priv; |
| 378 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); | ||
| 341 | }; | 379 | }; |
| 342 | 380 | ||
| 343 | /* | 381 | /* |
| @@ -349,6 +387,7 @@ struct nand_chip { | |||
| 349 | #define NAND_MFR_NATIONAL 0x8f | 387 | #define NAND_MFR_NATIONAL 0x8f |
| 350 | #define NAND_MFR_RENESAS 0x07 | 388 | #define NAND_MFR_RENESAS 0x07 |
| 351 | #define NAND_MFR_STMICRO 0x20 | 389 | #define NAND_MFR_STMICRO 0x20 |
| 390 | #define NAND_MFR_HYNIX 0xad | ||
| 352 | 391 | ||
| 353 | /** | 392 | /** |
| 354 | * struct nand_flash_dev - NAND Flash Device ID Structure | 393 | * struct nand_flash_dev - NAND Flash Device ID Structure |
| @@ -459,6 +498,9 @@ extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs); | |||
| 459 | extern int nand_default_bbt (struct mtd_info *mtd); | 498 | extern int nand_default_bbt (struct mtd_info *mtd); |
| 460 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); | 499 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); |
| 461 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); | 500 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); |
| 501 | extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | ||
| 502 | size_t * retlen, u_char * buf, u_char * oob_buf, | ||
| 503 | struct nand_oobinfo *oobsel, int flags); | ||
| 462 | 504 | ||
| 463 | /* | 505 | /* |
| 464 | * Constants for oob configuration | 506 | * Constants for oob configuration |
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h new file mode 100644 index 000000000000..2332eda07e0e --- /dev/null +++ b/include/linux/mtd/plat-ram.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* linux/include/mtd/plat-ram.h | ||
| 2 | * | ||
| 3 | * (c) 2004 Simtec Electronics | ||
| 4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
| 5 | * Ben Dooks <ben@simtec.co.uk> | ||
| 6 | * | ||
| 7 | * Generic platform device based RAM map | ||
| 8 | * | ||
| 9 | * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $ | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify | ||
| 12 | * it under the terms of the GNU General Public License version 2 as | ||
| 13 | * published by the Free Software Foundation. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef __LINUX_MTD_PLATRAM_H | ||
| 18 | #define __LINUX_MTD_PLATRAM_H __FILE__ | ||
| 19 | |||
| 20 | #define PLATRAM_RO (0) | ||
| 21 | #define PLATRAM_RW (1) | ||
| 22 | |||
| 23 | struct platdata_mtd_ram { | ||
| 24 | char *mapname; | ||
| 25 | char **probes; | ||
| 26 | struct mtd_partition *partitions; | ||
| 27 | int nr_partitions; | ||
| 28 | int bankwidth; | ||
| 29 | |||
| 30 | /* control callbacks */ | ||
| 31 | |||
| 32 | void (*set_rw)(struct device *dev, int to); | ||
| 33 | }; | ||
| 34 | |||
| 35 | #endif /* __LINUX_MTD_PLATRAM_H */ | ||
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index fc071125cbcc..7b7deef6b180 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h | |||
| @@ -58,22 +58,16 @@ | |||
| 58 | * returned value is <= the real elapsed time. | 58 | * returned value is <= the real elapsed time. |
| 59 | * note 2: this should be able to cope with a few seconds without | 59 | * note 2: this should be able to cope with a few seconds without |
| 60 | * overflowing. | 60 | * overflowing. |
| 61 | * | ||
| 62 | * xip_iprefetch() | ||
| 63 | * | ||
| 64 | * Macro to fill instruction prefetch | ||
| 65 | * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); | ||
| 61 | */ | 66 | */ |
| 62 | 67 | ||
| 63 | #if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) | 68 | #include <asm/mtd-xip.h> |
| 64 | |||
| 65 | #include <asm/hardware.h> | ||
| 66 | #ifdef CONFIG_ARCH_PXA | ||
| 67 | #include <asm/arch/pxa-regs.h> | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #define xip_irqpending() (ICIP & ICMR) | ||
| 71 | |||
| 72 | /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ | ||
| 73 | #define xip_currtime() (OSCR) | ||
| 74 | #define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4) | ||
| 75 | 69 | ||
| 76 | #else | 70 | #ifndef xip_irqpending |
| 77 | 71 | ||
| 78 | #warning "missing IRQ and timer primitives for XIP MTD support" | 72 | #warning "missing IRQ and timer primitives for XIP MTD support" |
| 79 | #warning "some of the XIP MTD support code will be disabled" | 73 | #warning "some of the XIP MTD support code will be disabled" |
| @@ -85,16 +79,17 @@ | |||
| 85 | 79 | ||
| 86 | #endif | 80 | #endif |
| 87 | 81 | ||
| 82 | #ifndef xip_iprefetch | ||
| 83 | #define xip_iprefetch() do { } while (0) | ||
| 84 | #endif | ||
| 85 | |||
| 88 | /* | 86 | /* |
| 89 | * xip_cpu_idle() is used when waiting for a delay equal or larger than | 87 | * xip_cpu_idle() is used when waiting for a delay equal or larger than |
| 90 | * the system timer tick period. This should put the CPU into idle mode | 88 | * the system timer tick period. This should put the CPU into idle mode |
| 91 | * to save power and to be woken up only when some interrupts are pending. | 89 | * to save power and to be woken up only when some interrupts are pending. |
| 92 | * As above, this should not rely upon standard kernel code. | 90 | * This should not rely upon standard kernel code. |
| 93 | */ | 91 | */ |
| 94 | 92 | #ifndef xip_cpu_idle | |
| 95 | #if defined(CONFIG_CPU_XSCALE) | ||
| 96 | #define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1)) | ||
| 97 | #else | ||
| 98 | #define xip_cpu_idle() do { } while (0) | 93 | #define xip_cpu_idle() do { } while (0) |
| 99 | #endif | 94 | #endif |
| 100 | 95 | ||
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 697991b69f9b..0e5a86f13b2f 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
| @@ -17,7 +17,8 @@ extern void __put_namespace(struct namespace *namespace); | |||
| 17 | 17 | ||
| 18 | static inline void put_namespace(struct namespace *namespace) | 18 | static inline void put_namespace(struct namespace *namespace) |
| 19 | { | 19 | { |
| 20 | if (atomic_dec_and_test(&namespace->count)) | 20 | if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock)) |
| 21 | /* releases vfsmount_lock */ | ||
| 21 | __put_namespace(namespace); | 22 | __put_namespace(namespace); |
| 22 | } | 23 | } |
| 23 | 24 | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 27e4d164a108..2f0c085f2c7d 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define NETLINK_AUDIT 9 /* auditing */ | 16 | #define NETLINK_AUDIT 9 /* auditing */ |
| 17 | #define NETLINK_FIB_LOOKUP 10 | 17 | #define NETLINK_FIB_LOOKUP 10 |
| 18 | #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ | 18 | #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ |
| 19 | #define NETLINK_NETFILTER 12 /* netfilter subsystem */ | ||
| 19 | #define NETLINK_IP6_FW 13 | 20 | #define NETLINK_IP6_FW 13 |
| 20 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 21 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ |
| 21 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ | 22 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 5791dfd30dd0..6d5a24f3fc6d 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
| @@ -124,6 +124,7 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *, | |||
| 124 | 124 | ||
| 125 | int nfsd_notify_change(struct inode *, struct iattr *); | 125 | int nfsd_notify_change(struct inode *, struct iattr *); |
| 126 | int nfsd_permission(struct svc_export *, struct dentry *, int); | 126 | int nfsd_permission(struct svc_export *, struct dentry *, int); |
| 127 | void nfsd_sync_dir(struct dentry *dp); | ||
| 127 | 128 | ||
| 128 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | 129 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) |
| 129 | #ifdef CONFIG_NFSD_V2_ACL | 130 | #ifdef CONFIG_NFSD_V2_ACL |
| @@ -230,6 +231,7 @@ void nfsd_lockd_shutdown(void); | |||
| 230 | #define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) | 231 | #define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) |
| 231 | #define nfserr_badname __constant_htonl(NFSERR_BADNAME) | 232 | #define nfserr_badname __constant_htonl(NFSERR_BADNAME) |
| 232 | #define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) | 233 | #define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) |
| 234 | #define nfserr_locked __constant_htonl(NFSERR_LOCKED) | ||
| 233 | 235 | ||
| 234 | /* error codes for internal use */ | 236 | /* error codes for internal use */ |
| 235 | /* if a request fails due to kmalloc failure, it gets dropped. | 237 | /* if a request fails due to kmalloc failure, it gets dropped. |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index a84a3fa99be1..8bf23cf8b603 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
| @@ -203,7 +203,9 @@ struct nfs4_stateowner { | |||
| 203 | int so_is_open_owner; /* 1=openowner,0=lockowner */ | 203 | int so_is_open_owner; /* 1=openowner,0=lockowner */ |
| 204 | u32 so_id; | 204 | u32 so_id; |
| 205 | struct nfs4_client * so_client; | 205 | struct nfs4_client * so_client; |
| 206 | u32 so_seqid; | 206 | /* after increment in ENCODE_SEQID_OP_TAIL, represents the next |
| 207 | * sequence id expected from the client: */ | ||
| 208 | u32 so_seqid; | ||
| 207 | struct xdr_netobj so_owner; /* open owner name */ | 209 | struct xdr_netobj so_owner; /* open owner name */ |
| 208 | int so_confirmed; /* successful OPEN_CONFIRM? */ | 210 | int so_confirmed; /* successful OPEN_CONFIRM? */ |
| 209 | struct nfs4_replay so_replay; | 211 | struct nfs4_replay so_replay; |
| @@ -235,6 +237,10 @@ struct nfs4_file { | |||
| 235 | * st_perlockowner: (open stateid) list of lock nfs4_stateowners | 237 | * st_perlockowner: (open stateid) list of lock nfs4_stateowners |
| 236 | * st_access_bmap: used only for open stateid | 238 | * st_access_bmap: used only for open stateid |
| 237 | * st_deny_bmap: used only for open stateid | 239 | * st_deny_bmap: used only for open stateid |
| 240 | * st_openstp: open stateid lock stateid was derived from | ||
| 241 | * | ||
| 242 | * XXX: open stateids and lock stateids have diverged sufficiently that | ||
| 243 | * we should consider defining separate structs for the two cases. | ||
| 238 | */ | 244 | */ |
| 239 | 245 | ||
| 240 | struct nfs4_stateid { | 246 | struct nfs4_stateid { |
| @@ -248,6 +254,7 @@ struct nfs4_stateid { | |||
| 248 | struct file * st_vfs_file; | 254 | struct file * st_vfs_file; |
| 249 | unsigned long st_access_bmap; | 255 | unsigned long st_access_bmap; |
| 250 | unsigned long st_deny_bmap; | 256 | unsigned long st_deny_bmap; |
| 257 | struct nfs4_stateid * st_openstp; | ||
| 251 | }; | 258 | }; |
| 252 | 259 | ||
| 253 | /* flags for preprocess_seqid_op() */ | 260 | /* flags for preprocess_seqid_op() */ |
diff --git a/include/linux/pci-dynids.h b/include/linux/pci-dynids.h deleted file mode 100644 index 183b6b0de81c..000000000000 --- a/include/linux/pci-dynids.h +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * PCI defines and function prototypes | ||
| 3 | * Copyright 2003 Dell Inc. | ||
| 4 | * by Matt Domsch <Matt_Domsch@dell.com> | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef LINUX_PCI_DYNIDS_H | ||
| 8 | #define LINUX_PCI_DYNIDS_H | ||
| 9 | |||
| 10 | #include <linux/list.h> | ||
| 11 | #include <linux/mod_devicetable.h> | ||
| 12 | |||
| 13 | struct dynid { | ||
| 14 | struct list_head node; | ||
| 15 | struct pci_device_id id; | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 66798b46f308..7ac14961ba22 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -586,7 +586,7 @@ struct pci_dev { | |||
| 586 | #define PCI_NUM_RESOURCES 11 | 586 | #define PCI_NUM_RESOURCES 11 |
| 587 | 587 | ||
| 588 | #ifndef PCI_BUS_NUM_RESOURCES | 588 | #ifndef PCI_BUS_NUM_RESOURCES |
| 589 | #define PCI_BUS_NUM_RESOURCES 4 | 589 | #define PCI_BUS_NUM_RESOURCES 8 |
| 590 | #endif | 590 | #endif |
| 591 | 591 | ||
| 592 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 592 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
| @@ -860,7 +860,8 @@ int pci_register_driver(struct pci_driver *); | |||
| 860 | void pci_unregister_driver(struct pci_driver *); | 860 | void pci_unregister_driver(struct pci_driver *); |
| 861 | void pci_remove_behind_bridge(struct pci_dev *); | 861 | void pci_remove_behind_bridge(struct pci_dev *); |
| 862 | struct pci_driver *pci_dev_driver(const struct pci_dev *); | 862 | struct pci_driver *pci_dev_driver(const struct pci_dev *); |
| 863 | const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); | 863 | const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev); |
| 864 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); | ||
| 864 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); | 865 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); |
| 865 | 866 | ||
| 866 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 867 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 14479325e3f3..7aeb208ed713 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -176,7 +176,7 @@ struct pm_ops { | |||
| 176 | }; | 176 | }; |
| 177 | 177 | ||
| 178 | extern void pm_set_ops(struct pm_ops *); | 178 | extern void pm_set_ops(struct pm_ops *); |
| 179 | 179 | extern struct pm_ops *pm_ops; | |
| 180 | extern int pm_suspend(suspend_state_t state); | 180 | extern int pm_suspend(suspend_state_t state); |
| 181 | 181 | ||
| 182 | 182 | ||
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index 0760507a545b..0a3605099c44 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
| @@ -4,29 +4,29 @@ | |||
| 4 | #define REISERFS_ACL_VERSION 0x0001 | 4 | #define REISERFS_ACL_VERSION 0x0001 |
| 5 | 5 | ||
| 6 | typedef struct { | 6 | typedef struct { |
| 7 | __le16 e_tag; | 7 | __le16 e_tag; |
| 8 | __le16 e_perm; | 8 | __le16 e_perm; |
| 9 | __le32 e_id; | 9 | __le32 e_id; |
| 10 | } reiserfs_acl_entry; | 10 | } reiserfs_acl_entry; |
| 11 | 11 | ||
| 12 | typedef struct { | 12 | typedef struct { |
| 13 | __le16 e_tag; | 13 | __le16 e_tag; |
| 14 | __le16 e_perm; | 14 | __le16 e_perm; |
| 15 | } reiserfs_acl_entry_short; | 15 | } reiserfs_acl_entry_short; |
| 16 | 16 | ||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | __le32 a_version; | 18 | __le32 a_version; |
| 19 | } reiserfs_acl_header; | 19 | } reiserfs_acl_header; |
| 20 | 20 | ||
| 21 | static inline size_t reiserfs_acl_size(int count) | 21 | static inline size_t reiserfs_acl_size(int count) |
| 22 | { | 22 | { |
| 23 | if (count <= 4) { | 23 | if (count <= 4) { |
| 24 | return sizeof(reiserfs_acl_header) + | 24 | return sizeof(reiserfs_acl_header) + |
| 25 | count * sizeof(reiserfs_acl_entry_short); | 25 | count * sizeof(reiserfs_acl_entry_short); |
| 26 | } else { | 26 | } else { |
| 27 | return sizeof(reiserfs_acl_header) + | 27 | return sizeof(reiserfs_acl_header) + |
| 28 | 4 * sizeof(reiserfs_acl_entry_short) + | 28 | 4 * sizeof(reiserfs_acl_entry_short) + |
| 29 | (count - 4) * sizeof(reiserfs_acl_entry); | 29 | (count - 4) * sizeof(reiserfs_acl_entry); |
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| 32 | 32 | ||
| @@ -46,14 +46,14 @@ static inline int reiserfs_acl_count(size_t size) | |||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | |||
| 50 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
| 51 | struct posix_acl * reiserfs_get_acl(struct inode *inode, int type); | 50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); |
| 52 | int reiserfs_acl_chmod (struct inode *inode); | 51 | int reiserfs_acl_chmod(struct inode *inode); |
| 53 | int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode); | 52 | int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, |
| 54 | int reiserfs_cache_default_acl (struct inode *dir); | 53 | struct inode *inode); |
| 55 | extern int reiserfs_xattr_posix_acl_init (void) __init; | 54 | int reiserfs_cache_default_acl(struct inode *dir); |
| 56 | extern int reiserfs_xattr_posix_acl_exit (void); | 55 | extern int reiserfs_xattr_posix_acl_init(void) __init; |
| 56 | extern int reiserfs_xattr_posix_acl_exit(void); | ||
| 57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; | 57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; |
| 58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; | 58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; |
| 59 | #else | 59 | #else |
| @@ -61,28 +61,26 @@ extern struct reiserfs_xattr_handler posix_acl_access_handler; | |||
| 61 | #define reiserfs_get_acl NULL | 61 | #define reiserfs_get_acl NULL |
| 62 | #define reiserfs_cache_default_acl(inode) 0 | 62 | #define reiserfs_cache_default_acl(inode) 0 |
| 63 | 63 | ||
| 64 | static inline int | 64 | static inline int reiserfs_xattr_posix_acl_init(void) |
| 65 | reiserfs_xattr_posix_acl_init (void) | ||
| 66 | { | 65 | { |
| 67 | return 0; | 66 | return 0; |
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | static inline int | 69 | static inline int reiserfs_xattr_posix_acl_exit(void) |
| 71 | reiserfs_xattr_posix_acl_exit (void) | ||
| 72 | { | 70 | { |
| 73 | return 0; | 71 | return 0; |
| 74 | } | 72 | } |
| 75 | 73 | ||
| 76 | static inline int | 74 | static inline int reiserfs_acl_chmod(struct inode *inode) |
| 77 | reiserfs_acl_chmod (struct inode *inode) | ||
| 78 | { | 75 | { |
| 79 | return 0; | 76 | return 0; |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | static inline int | 79 | static inline int |
| 83 | reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode) | 80 | reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry, |
| 81 | struct inode *inode) | ||
| 84 | { | 82 | { |
| 85 | return 0; | 83 | return 0; |
| 86 | } | 84 | } |
| 87 | 85 | ||
| 88 | #endif | 86 | #endif |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 4c7c5689ad93..17e458e17e2b 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -3,11 +3,10 @@ | |||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | /* this file has an amazingly stupid | 5 | /* this file has an amazingly stupid |
| 6 | name, yura please fix it to be | 6 | name, yura please fix it to be |
| 7 | reiserfs.h, and merge all the rest | 7 | reiserfs.h, and merge all the rest |
| 8 | of our .h files that are in this | 8 | of our .h files that are in this |
| 9 | directory into it. */ | 9 | directory into it. */ |
| 10 | |||
| 11 | 10 | ||
| 12 | #ifndef _LINUX_REISER_FS_H | 11 | #ifndef _LINUX_REISER_FS_H |
| 13 | #define _LINUX_REISER_FS_H | 12 | #define _LINUX_REISER_FS_H |
| @@ -74,9 +73,9 @@ | |||
| 74 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug | 73 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug |
| 75 | ** messages. | 74 | ** messages. |
| 76 | */ | 75 | */ |
| 77 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | 76 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ |
| 78 | 77 | ||
| 79 | void reiserfs_warning (struct super_block *s, const char * fmt, ...); | 78 | void reiserfs_warning(struct super_block *s, const char *fmt, ...); |
| 80 | /* assertions handling */ | 79 | /* assertions handling */ |
| 81 | 80 | ||
| 82 | /** always check a condition and panic if it's false. */ | 81 | /** always check a condition and panic if it's false. */ |
| @@ -105,82 +104,78 @@ if( !( cond ) ) \ | |||
| 105 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs | 104 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs |
| 106 | * the version in RAM is part of a larger structure containing fields never written to disk. | 105 | * the version in RAM is part of a larger structure containing fields never written to disk. |
| 107 | */ | 106 | */ |
| 108 | #define UNSET_HASH 0 // read_super will guess about, what hash names | 107 | #define UNSET_HASH 0 // read_super will guess about, what hash names |
| 109 | // in directories were sorted with | 108 | // in directories were sorted with |
| 110 | #define TEA_HASH 1 | 109 | #define TEA_HASH 1 |
| 111 | #define YURA_HASH 2 | 110 | #define YURA_HASH 2 |
| 112 | #define R5_HASH 3 | 111 | #define R5_HASH 3 |
| 113 | #define DEFAULT_HASH R5_HASH | 112 | #define DEFAULT_HASH R5_HASH |
| 114 | 113 | ||
| 115 | |||
| 116 | struct journal_params { | 114 | struct journal_params { |
| 117 | __le32 jp_journal_1st_block; /* where does journal start from on its | 115 | __le32 jp_journal_1st_block; /* where does journal start from on its |
| 118 | * device */ | 116 | * device */ |
| 119 | __le32 jp_journal_dev; /* journal device st_rdev */ | 117 | __le32 jp_journal_dev; /* journal device st_rdev */ |
| 120 | __le32 jp_journal_size; /* size of the journal */ | 118 | __le32 jp_journal_size; /* size of the journal */ |
| 121 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ | 119 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ |
| 122 | __le32 jp_journal_magic; /* random value made on fs creation (this | 120 | __le32 jp_journal_magic; /* random value made on fs creation (this |
| 123 | * was sb_journal_block_count) */ | 121 | * was sb_journal_block_count) */ |
| 124 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a | 122 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a |
| 125 | * trans */ | 123 | * trans */ |
| 126 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async | 124 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async |
| 127 | * commit be */ | 125 | * commit be */ |
| 128 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction | 126 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction |
| 129 | * be */ | 127 | * be */ |
| 130 | }; | 128 | }; |
| 131 | 129 | ||
| 132 | /* this is the super from 3.5.X, where X >= 10 */ | 130 | /* this is the super from 3.5.X, where X >= 10 */ |
| 133 | struct reiserfs_super_block_v1 | 131 | struct reiserfs_super_block_v1 { |
| 134 | { | 132 | __le32 s_block_count; /* blocks count */ |
| 135 | __le32 s_block_count; /* blocks count */ | 133 | __le32 s_free_blocks; /* free blocks count */ |
| 136 | __le32 s_free_blocks; /* free blocks count */ | 134 | __le32 s_root_block; /* root block number */ |
| 137 | __le32 s_root_block; /* root block number */ | 135 | struct journal_params s_journal; |
| 138 | struct journal_params s_journal; | 136 | __le16 s_blocksize; /* block size */ |
| 139 | __le16 s_blocksize; /* block size */ | 137 | __le16 s_oid_maxsize; /* max size of object id array, see |
| 140 | __le16 s_oid_maxsize; /* max size of object id array, see | 138 | * get_objectid() commentary */ |
| 141 | * get_objectid() commentary */ | 139 | __le16 s_oid_cursize; /* current size of object id array */ |
| 142 | __le16 s_oid_cursize; /* current size of object id array */ | 140 | __le16 s_umount_state; /* this is set to 1 when filesystem was |
| 143 | __le16 s_umount_state; /* this is set to 1 when filesystem was | 141 | * umounted, to 2 - when not */ |
| 144 | * umounted, to 2 - when not */ | 142 | char s_magic[10]; /* reiserfs magic string indicates that |
| 145 | char s_magic[10]; /* reiserfs magic string indicates that | 143 | * file system is reiserfs: |
| 146 | * file system is reiserfs: | 144 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ |
| 147 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | 145 | __le16 s_fs_state; /* it is set to used by fsck to mark which |
| 148 | __le16 s_fs_state; /* it is set to used by fsck to mark which | 146 | * phase of rebuilding is done */ |
| 149 | * phase of rebuilding is done */ | 147 | __le32 s_hash_function_code; /* indicate, what hash function is being use |
| 150 | __le32 s_hash_function_code; /* indicate, what hash function is being use | 148 | * to sort names in a directory*/ |
| 151 | * to sort names in a directory*/ | 149 | __le16 s_tree_height; /* height of disk tree */ |
| 152 | __le16 s_tree_height; /* height of disk tree */ | 150 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address |
| 153 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address | 151 | * each block of file system */ |
| 154 | * each block of file system */ | 152 | __le16 s_version; /* this field is only reliable on filesystem |
| 155 | __le16 s_version; /* this field is only reliable on filesystem | 153 | * with non-standard journal */ |
| 156 | * with non-standard journal */ | 154 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main |
| 157 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main | 155 | * device, we need to keep after |
| 158 | * device, we need to keep after | 156 | * making fs with non-standard journal */ |
| 159 | * making fs with non-standard journal */ | ||
| 160 | } __attribute__ ((__packed__)); | 157 | } __attribute__ ((__packed__)); |
| 161 | 158 | ||
| 162 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) | 159 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) |
| 163 | 160 | ||
| 164 | /* this is the on disk super block */ | 161 | /* this is the on disk super block */ |
| 165 | struct reiserfs_super_block | 162 | struct reiserfs_super_block { |
| 166 | { | 163 | struct reiserfs_super_block_v1 s_v1; |
| 167 | struct reiserfs_super_block_v1 s_v1; | 164 | __le32 s_inode_generation; |
| 168 | __le32 s_inode_generation; | 165 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ |
| 169 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | 166 | unsigned char s_uuid[16]; /* filesystem unique identifier */ |
| 170 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | 167 | unsigned char s_label[16]; /* filesystem volume label */ |
| 171 | unsigned char s_label[16]; /* filesystem volume label */ | 168 | char s_unused[88]; /* zero filled by mkreiserfs and |
| 172 | char s_unused[88] ; /* zero filled by mkreiserfs and | 169 | * reiserfs_convert_objectid_map_v1() |
| 173 | * reiserfs_convert_objectid_map_v1() | 170 | * so any additions must be updated |
| 174 | * so any additions must be updated | 171 | * there as well. */ |
| 175 | * there as well. */ | 172 | } __attribute__ ((__packed__)); |
| 176 | } __attribute__ ((__packed__)); | ||
| 177 | 173 | ||
| 178 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) | 174 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) |
| 179 | 175 | ||
| 180 | #define REISERFS_VERSION_1 0 | 176 | #define REISERFS_VERSION_1 0 |
| 181 | #define REISERFS_VERSION_2 2 | 177 | #define REISERFS_VERSION_2 2 |
| 182 | 178 | ||
| 183 | |||
| 184 | // on-disk super block fields converted to cpu form | 179 | // on-disk super block fields converted to cpu form |
| 185 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) | 180 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) |
| 186 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) | 181 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) |
| @@ -210,13 +205,12 @@ struct reiserfs_super_block | |||
| 210 | #define PUT_SB_TREE_HEIGHT(s, val) \ | 205 | #define PUT_SB_TREE_HEIGHT(s, val) \ |
| 211 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) | 206 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) |
| 212 | #define PUT_SB_REISERFS_STATE(s, val) \ | 207 | #define PUT_SB_REISERFS_STATE(s, val) \ |
| 213 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) | 208 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) |
| 214 | #define PUT_SB_VERSION(s, val) \ | 209 | #define PUT_SB_VERSION(s, val) \ |
| 215 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) | 210 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) |
| 216 | #define PUT_SB_BMAP_NR(s, val) \ | 211 | #define PUT_SB_BMAP_NR(s, val) \ |
| 217 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) | 212 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) |
| 218 | 213 | ||
| 219 | |||
| 220 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) | 214 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) |
| 221 | #define SB_ONDISK_JOURNAL_SIZE(s) \ | 215 | #define SB_ONDISK_JOURNAL_SIZE(s) \ |
| 222 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) | 216 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) |
| @@ -231,21 +225,19 @@ struct reiserfs_super_block | |||
| 231 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ | 225 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ |
| 232 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ | 226 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ |
| 233 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | 227 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ |
| 234 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | 228 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) |
| 235 | |||
| 236 | |||
| 237 | 229 | ||
| 238 | /* used by gcc */ | 230 | /* used by gcc */ |
| 239 | #define REISERFS_SUPER_MAGIC 0x52654973 | 231 | #define REISERFS_SUPER_MAGIC 0x52654973 |
| 240 | /* used by file system utilities that | 232 | /* used by file system utilities that |
| 241 | look at the superblock, etc. */ | 233 | look at the superblock, etc. */ |
| 242 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | 234 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" |
| 243 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | 235 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" |
| 244 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | 236 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
| 245 | 237 | ||
| 246 | int is_reiserfs_3_5 (struct reiserfs_super_block * rs); | 238 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); |
| 247 | int is_reiserfs_3_6 (struct reiserfs_super_block * rs); | 239 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); |
| 248 | int is_reiserfs_jr (struct reiserfs_super_block * rs); | 240 | int is_reiserfs_jr(struct reiserfs_super_block *rs); |
| 249 | 241 | ||
| 250 | /* ReiserFS leaves the first 64k unused, so that partition labels have | 242 | /* ReiserFS leaves the first 64k unused, so that partition labels have |
| 251 | enough space. If someone wants to write a fancy bootloader that | 243 | enough space. If someone wants to write a fancy bootloader that |
| @@ -272,8 +264,8 @@ typedef __u32 b_blocknr_t; | |||
| 272 | typedef __le32 unp_t; | 264 | typedef __le32 unp_t; |
| 273 | 265 | ||
| 274 | struct unfm_nodeinfo { | 266 | struct unfm_nodeinfo { |
| 275 | unp_t unfm_nodenum; | 267 | unp_t unfm_nodenum; |
| 276 | unsigned short unfm_freespace; | 268 | unsigned short unfm_freespace; |
| 277 | }; | 269 | }; |
| 278 | 270 | ||
| 279 | /* there are two formats of keys: 3.5 and 3.6 | 271 | /* there are two formats of keys: 3.5 and 3.6 |
| @@ -285,7 +277,6 @@ struct unfm_nodeinfo { | |||
| 285 | #define STAT_DATA_V1 0 | 277 | #define STAT_DATA_V1 0 |
| 286 | #define STAT_DATA_V2 1 | 278 | #define STAT_DATA_V2 1 |
| 287 | 279 | ||
| 288 | |||
| 289 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) | 280 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) |
| 290 | { | 281 | { |
| 291 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); | 282 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); |
| @@ -343,15 +334,13 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
| 343 | file would fit into one DIRECT item. | 334 | file would fit into one DIRECT item. |
| 344 | Primary intention for this one is to increase performance by decreasing | 335 | Primary intention for this one is to increase performance by decreasing |
| 345 | seeking. | 336 | seeking. |
| 346 | */ | 337 | */ |
| 347 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ | 338 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ |
| 348 | (\ | 339 | (\ |
| 349 | (!(n_tail_size)) || \ | 340 | (!(n_tail_size)) || \ |
| 350 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ | 341 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ |
| 351 | ) | 342 | ) |
| 352 | 343 | ||
| 353 | |||
| 354 | |||
| 355 | /* | 344 | /* |
| 356 | * values for s_umount_state field | 345 | * values for s_umount_state field |
| 357 | */ | 346 | */ |
| @@ -364,9 +353,9 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
| 364 | #define TYPE_STAT_DATA 0 | 353 | #define TYPE_STAT_DATA 0 |
| 365 | #define TYPE_INDIRECT 1 | 354 | #define TYPE_INDIRECT 1 |
| 366 | #define TYPE_DIRECT 2 | 355 | #define TYPE_DIRECT 2 |
| 367 | #define TYPE_DIRENTRY 3 | 356 | #define TYPE_DIRENTRY 3 |
| 368 | #define TYPE_MAXTYPE 3 | 357 | #define TYPE_MAXTYPE 3 |
| 369 | #define TYPE_ANY 15 // FIXME: comment is required | 358 | #define TYPE_ANY 15 // FIXME: comment is required |
| 370 | 359 | ||
| 371 | /***************************************************************************/ | 360 | /***************************************************************************/ |
| 372 | /* KEY & ITEM HEAD */ | 361 | /* KEY & ITEM HEAD */ |
| @@ -376,60 +365,62 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
| 376 | // directories use this key as well as old files | 365 | // directories use this key as well as old files |
| 377 | // | 366 | // |
| 378 | struct offset_v1 { | 367 | struct offset_v1 { |
| 379 | __le32 k_offset; | 368 | __le32 k_offset; |
| 380 | __le32 k_uniqueness; | 369 | __le32 k_uniqueness; |
| 381 | } __attribute__ ((__packed__)); | 370 | } __attribute__ ((__packed__)); |
| 382 | 371 | ||
| 383 | struct offset_v2 { | 372 | struct offset_v2 { |
| 384 | __le64 v; | 373 | __le64 v; |
| 385 | } __attribute__ ((__packed__)); | 374 | } __attribute__ ((__packed__)); |
| 386 | 375 | ||
| 387 | static inline __u16 offset_v2_k_type( const struct offset_v2 *v2 ) | 376 | static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) |
| 388 | { | 377 | { |
| 389 | __u8 type = le64_to_cpu(v2->v) >> 60; | 378 | __u8 type = le64_to_cpu(v2->v) >> 60; |
| 390 | return (type <= TYPE_MAXTYPE)?type:TYPE_ANY; | 379 | return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; |
| 391 | } | 380 | } |
| 392 | 381 | ||
| 393 | static inline void set_offset_v2_k_type( struct offset_v2 *v2, int type ) | 382 | static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) |
| 394 | { | 383 | { |
| 395 | v2->v = (v2->v & cpu_to_le64(~0ULL>>4)) | cpu_to_le64((__u64)type<<60); | 384 | v2->v = |
| 385 | (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); | ||
| 396 | } | 386 | } |
| 397 | 387 | ||
| 398 | static inline loff_t offset_v2_k_offset( const struct offset_v2 *v2 ) | 388 | static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) |
| 399 | { | 389 | { |
| 400 | return le64_to_cpu(v2->v) & (~0ULL>>4); | 390 | return le64_to_cpu(v2->v) & (~0ULL >> 4); |
| 401 | } | 391 | } |
| 402 | 392 | ||
| 403 | static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset ){ | 393 | static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) |
| 404 | offset &= (~0ULL>>4); | 394 | { |
| 405 | v2->v = (v2->v & cpu_to_le64(15ULL<<60)) | cpu_to_le64(offset); | 395 | offset &= (~0ULL >> 4); |
| 396 | v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); | ||
| 406 | } | 397 | } |
| 407 | 398 | ||
| 408 | /* Key of an item determines its location in the S+tree, and | 399 | /* Key of an item determines its location in the S+tree, and |
| 409 | is composed of 4 components */ | 400 | is composed of 4 components */ |
| 410 | struct reiserfs_key { | 401 | struct reiserfs_key { |
| 411 | __le32 k_dir_id; /* packing locality: by default parent | 402 | __le32 k_dir_id; /* packing locality: by default parent |
| 412 | directory object id */ | 403 | directory object id */ |
| 413 | __le32 k_objectid; /* object identifier */ | 404 | __le32 k_objectid; /* object identifier */ |
| 414 | union { | 405 | union { |
| 415 | struct offset_v1 k_offset_v1; | 406 | struct offset_v1 k_offset_v1; |
| 416 | struct offset_v2 k_offset_v2; | 407 | struct offset_v2 k_offset_v2; |
| 417 | } __attribute__ ((__packed__)) u; | 408 | } __attribute__ ((__packed__)) u; |
| 418 | } __attribute__ ((__packed__)); | 409 | } __attribute__ ((__packed__)); |
| 419 | 410 | ||
| 420 | struct in_core_key { | 411 | struct in_core_key { |
| 421 | __u32 k_dir_id; /* packing locality: by default parent | 412 | __u32 k_dir_id; /* packing locality: by default parent |
| 422 | directory object id */ | 413 | directory object id */ |
| 423 | __u32 k_objectid; /* object identifier */ | 414 | __u32 k_objectid; /* object identifier */ |
| 424 | __u64 k_offset; | 415 | __u64 k_offset; |
| 425 | __u8 k_type; | 416 | __u8 k_type; |
| 426 | }; | 417 | }; |
| 427 | 418 | ||
| 428 | struct cpu_key { | 419 | struct cpu_key { |
| 429 | struct in_core_key on_disk_key; | 420 | struct in_core_key on_disk_key; |
| 430 | int version; | 421 | int version; |
| 431 | int key_length; /* 3 in all cases but direct2indirect and | 422 | int key_length; /* 3 in all cases but direct2indirect and |
| 432 | indirect2direct conversion */ | 423 | indirect2direct conversion */ |
| 433 | }; | 424 | }; |
| 434 | 425 | ||
| 435 | /* Our function for comparing keys can compare keys of different | 426 | /* Our function for comparing keys can compare keys of different |
| @@ -475,8 +466,7 @@ struct cpu_key { | |||
| 475 | indirect items) and specifies the location of the item itself | 466 | indirect items) and specifies the location of the item itself |
| 476 | within the block. */ | 467 | within the block. */ |
| 477 | 468 | ||
| 478 | struct item_head | 469 | struct item_head { |
| 479 | { | ||
| 480 | /* Everything in the tree is found by searching for it based on | 470 | /* Everything in the tree is found by searching for it based on |
| 481 | * its key.*/ | 471 | * its key.*/ |
| 482 | struct reiserfs_key ih_key; | 472 | struct reiserfs_key ih_key; |
| @@ -492,13 +482,13 @@ struct item_head | |||
| 492 | number of directory entries in the directory item. */ | 482 | number of directory entries in the directory item. */ |
| 493 | __le16 ih_entry_count; | 483 | __le16 ih_entry_count; |
| 494 | } __attribute__ ((__packed__)) u; | 484 | } __attribute__ ((__packed__)) u; |
| 495 | __le16 ih_item_len; /* total size of the item body */ | 485 | __le16 ih_item_len; /* total size of the item body */ |
| 496 | __le16 ih_item_location; /* an offset to the item body | 486 | __le16 ih_item_location; /* an offset to the item body |
| 497 | * within the block */ | 487 | * within the block */ |
| 498 | __le16 ih_version; /* 0 for all old items, 2 for new | 488 | __le16 ih_version; /* 0 for all old items, 2 for new |
| 499 | ones. Highest bit is set by fsck | 489 | ones. Highest bit is set by fsck |
| 500 | temporary, cleaned after all | 490 | temporary, cleaned after all |
| 501 | done */ | 491 | done */ |
| 502 | } __attribute__ ((__packed__)); | 492 | } __attribute__ ((__packed__)); |
| 503 | /* size of item header */ | 493 | /* size of item header */ |
| 504 | #define IH_SIZE (sizeof(struct item_head)) | 494 | #define IH_SIZE (sizeof(struct item_head)) |
| @@ -515,7 +505,6 @@ struct item_head | |||
| 515 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) | 505 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) |
| 516 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) | 506 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) |
| 517 | 507 | ||
| 518 | |||
| 519 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) | 508 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) |
| 520 | 509 | ||
| 521 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) | 510 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) |
| @@ -537,40 +526,48 @@ struct item_head | |||
| 537 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe | 526 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe |
| 538 | #define V1_DIRECT_UNIQUENESS 0xffffffff | 527 | #define V1_DIRECT_UNIQUENESS 0xffffffff |
| 539 | #define V1_DIRENTRY_UNIQUENESS 500 | 528 | #define V1_DIRENTRY_UNIQUENESS 500 |
| 540 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required | 529 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required |
| 541 | 530 | ||
| 542 | // | 531 | // |
| 543 | // here are conversion routines | 532 | // here are conversion routines |
| 544 | // | 533 | // |
| 545 | static inline int uniqueness2type (__u32 uniqueness) CONSTF; | 534 | static inline int uniqueness2type(__u32 uniqueness) CONSTF; |
| 546 | static inline int uniqueness2type (__u32 uniqueness) | 535 | static inline int uniqueness2type(__u32 uniqueness) |
| 547 | { | 536 | { |
| 548 | switch ((int)uniqueness) { | 537 | switch ((int)uniqueness) { |
| 549 | case V1_SD_UNIQUENESS: return TYPE_STAT_DATA; | 538 | case V1_SD_UNIQUENESS: |
| 550 | case V1_INDIRECT_UNIQUENESS: return TYPE_INDIRECT; | 539 | return TYPE_STAT_DATA; |
| 551 | case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT; | 540 | case V1_INDIRECT_UNIQUENESS: |
| 552 | case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY; | 541 | return TYPE_INDIRECT; |
| 553 | default: | 542 | case V1_DIRECT_UNIQUENESS: |
| 554 | reiserfs_warning (NULL, "vs-500: unknown uniqueness %d", | 543 | return TYPE_DIRECT; |
| 555 | uniqueness); | 544 | case V1_DIRENTRY_UNIQUENESS: |
| 545 | return TYPE_DIRENTRY; | ||
| 546 | default: | ||
| 547 | reiserfs_warning(NULL, "vs-500: unknown uniqueness %d", | ||
| 548 | uniqueness); | ||
| 556 | case V1_ANY_UNIQUENESS: | 549 | case V1_ANY_UNIQUENESS: |
| 557 | return TYPE_ANY; | 550 | return TYPE_ANY; |
| 558 | } | 551 | } |
| 559 | } | 552 | } |
| 560 | 553 | ||
| 561 | static inline __u32 type2uniqueness (int type) CONSTF; | 554 | static inline __u32 type2uniqueness(int type) CONSTF; |
| 562 | static inline __u32 type2uniqueness (int type) | 555 | static inline __u32 type2uniqueness(int type) |
| 563 | { | 556 | { |
| 564 | switch (type) { | 557 | switch (type) { |
| 565 | case TYPE_STAT_DATA: return V1_SD_UNIQUENESS; | 558 | case TYPE_STAT_DATA: |
| 566 | case TYPE_INDIRECT: return V1_INDIRECT_UNIQUENESS; | 559 | return V1_SD_UNIQUENESS; |
| 567 | case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS; | 560 | case TYPE_INDIRECT: |
| 568 | case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS; | 561 | return V1_INDIRECT_UNIQUENESS; |
| 569 | default: | 562 | case TYPE_DIRECT: |
| 570 | reiserfs_warning (NULL, "vs-501: unknown type %d", type); | 563 | return V1_DIRECT_UNIQUENESS; |
| 564 | case TYPE_DIRENTRY: | ||
| 565 | return V1_DIRENTRY_UNIQUENESS; | ||
| 566 | default: | ||
| 567 | reiserfs_warning(NULL, "vs-501: unknown type %d", type); | ||
| 571 | case TYPE_ANY: | 568 | case TYPE_ANY: |
| 572 | return V1_ANY_UNIQUENESS; | 569 | return V1_ANY_UNIQUENESS; |
| 573 | } | 570 | } |
| 574 | } | 571 | } |
| 575 | 572 | ||
| 576 | // | 573 | // |
| @@ -578,57 +575,56 @@ static inline __u32 type2uniqueness (int type) | |||
| 578 | // there is no way to get version of object from key, so, provide | 575 | // there is no way to get version of object from key, so, provide |
| 579 | // version to these defines | 576 | // version to these defines |
| 580 | // | 577 | // |
| 581 | static inline loff_t le_key_k_offset (int version, const struct reiserfs_key * key) | 578 | static inline loff_t le_key_k_offset(int version, |
| 579 | const struct reiserfs_key *key) | ||
| 582 | { | 580 | { |
| 583 | return (version == KEY_FORMAT_3_5) ? | 581 | return (version == KEY_FORMAT_3_5) ? |
| 584 | le32_to_cpu( key->u.k_offset_v1.k_offset ) : | 582 | le32_to_cpu(key->u.k_offset_v1.k_offset) : |
| 585 | offset_v2_k_offset( &(key->u.k_offset_v2) ); | 583 | offset_v2_k_offset(&(key->u.k_offset_v2)); |
| 586 | } | 584 | } |
| 587 | 585 | ||
| 588 | static inline loff_t le_ih_k_offset (const struct item_head * ih) | 586 | static inline loff_t le_ih_k_offset(const struct item_head *ih) |
| 589 | { | 587 | { |
| 590 | return le_key_k_offset (ih_version (ih), &(ih->ih_key)); | 588 | return le_key_k_offset(ih_version(ih), &(ih->ih_key)); |
| 591 | } | 589 | } |
| 592 | 590 | ||
| 593 | static inline loff_t le_key_k_type (int version, const struct reiserfs_key * key) | 591 | static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key) |
| 594 | { | 592 | { |
| 595 | return (version == KEY_FORMAT_3_5) ? | 593 | return (version == KEY_FORMAT_3_5) ? |
| 596 | uniqueness2type( le32_to_cpu( key->u.k_offset_v1.k_uniqueness)) : | 594 | uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) : |
| 597 | offset_v2_k_type( &(key->u.k_offset_v2) ); | 595 | offset_v2_k_type(&(key->u.k_offset_v2)); |
| 598 | } | 596 | } |
| 599 | 597 | ||
| 600 | static inline loff_t le_ih_k_type (const struct item_head * ih) | 598 | static inline loff_t le_ih_k_type(const struct item_head *ih) |
| 601 | { | 599 | { |
| 602 | return le_key_k_type (ih_version (ih), &(ih->ih_key)); | 600 | return le_key_k_type(ih_version(ih), &(ih->ih_key)); |
| 603 | } | 601 | } |
| 604 | 602 | ||
| 605 | 603 | static inline void set_le_key_k_offset(int version, struct reiserfs_key *key, | |
| 606 | static inline void set_le_key_k_offset (int version, struct reiserfs_key * key, loff_t offset) | 604 | loff_t offset) |
| 607 | { | 605 | { |
| 608 | (version == KEY_FORMAT_3_5) ? | 606 | (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */ |
| 609 | (void)(key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */ | 607 | (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset)); |
| 610 | (void)(set_offset_v2_k_offset( &(key->u.k_offset_v2), offset )); | ||
| 611 | } | 608 | } |
| 612 | 609 | ||
| 613 | 610 | static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset) | |
| 614 | static inline void set_le_ih_k_offset (struct item_head * ih, loff_t offset) | ||
| 615 | { | 611 | { |
| 616 | set_le_key_k_offset (ih_version (ih), &(ih->ih_key), offset); | 612 | set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset); |
| 617 | } | 613 | } |
| 618 | 614 | ||
| 619 | 615 | static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | |
| 620 | static inline void set_le_key_k_type (int version, struct reiserfs_key * key, int type) | 616 | int type) |
| 621 | { | 617 | { |
| 622 | (version == KEY_FORMAT_3_5) ? | 618 | (version == KEY_FORMAT_3_5) ? |
| 623 | (void)(key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))): | 619 | (void)(key->u.k_offset_v1.k_uniqueness = |
| 624 | (void)(set_offset_v2_k_type( &(key->u.k_offset_v2), type )); | 620 | cpu_to_le32(type2uniqueness(type))) |
| 621 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | ||
| 625 | } | 622 | } |
| 626 | static inline void set_le_ih_k_type (struct item_head * ih, int type) | 623 | static inline void set_le_ih_k_type(struct item_head *ih, int type) |
| 627 | { | 624 | { |
| 628 | set_le_key_k_type (ih_version (ih), &(ih->ih_key), type); | 625 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); |
| 629 | } | 626 | } |
| 630 | 627 | ||
| 631 | |||
| 632 | #define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) | 628 | #define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) |
| 633 | #define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) | 629 | #define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) |
| 634 | #define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) | 630 | #define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) |
| @@ -642,34 +638,32 @@ static inline void set_le_ih_k_type (struct item_head * ih, int type) | |||
| 642 | #define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) | 638 | #define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) |
| 643 | #define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) | 639 | #define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) |
| 644 | 640 | ||
| 645 | |||
| 646 | |||
| 647 | // | 641 | // |
| 648 | // key is pointer to cpu key, result is cpu | 642 | // key is pointer to cpu key, result is cpu |
| 649 | // | 643 | // |
| 650 | static inline loff_t cpu_key_k_offset (const struct cpu_key * key) | 644 | static inline loff_t cpu_key_k_offset(const struct cpu_key *key) |
| 651 | { | 645 | { |
| 652 | return key->on_disk_key.k_offset; | 646 | return key->on_disk_key.k_offset; |
| 653 | } | 647 | } |
| 654 | 648 | ||
| 655 | static inline loff_t cpu_key_k_type (const struct cpu_key * key) | 649 | static inline loff_t cpu_key_k_type(const struct cpu_key *key) |
| 656 | { | 650 | { |
| 657 | return key->on_disk_key.k_type; | 651 | return key->on_disk_key.k_type; |
| 658 | } | 652 | } |
| 659 | 653 | ||
| 660 | static inline void set_cpu_key_k_offset (struct cpu_key * key, loff_t offset) | 654 | static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset) |
| 661 | { | 655 | { |
| 662 | key->on_disk_key.k_offset = offset; | 656 | key->on_disk_key.k_offset = offset; |
| 663 | } | 657 | } |
| 664 | 658 | ||
| 665 | static inline void set_cpu_key_k_type (struct cpu_key * key, int type) | 659 | static inline void set_cpu_key_k_type(struct cpu_key *key, int type) |
| 666 | { | 660 | { |
| 667 | key->on_disk_key.k_type = type; | 661 | key->on_disk_key.k_type = type; |
| 668 | } | 662 | } |
| 669 | 663 | ||
| 670 | static inline void cpu_key_k_offset_dec (struct cpu_key * key) | 664 | static inline void cpu_key_k_offset_dec(struct cpu_key *key) |
| 671 | { | 665 | { |
| 672 | key->on_disk_key.k_offset --; | 666 | key->on_disk_key.k_offset--; |
| 673 | } | 667 | } |
| 674 | 668 | ||
| 675 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) | 669 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) |
| @@ -677,34 +671,25 @@ static inline void cpu_key_k_offset_dec (struct cpu_key * key) | |||
| 677 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) | 671 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) |
| 678 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) | 672 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) |
| 679 | 673 | ||
| 680 | |||
| 681 | /* are these used ? */ | 674 | /* are these used ? */ |
| 682 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) | 675 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) |
| 683 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) | 676 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) |
| 684 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | 677 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) |
| 685 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | 678 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) |
| 686 | 679 | ||
| 687 | |||
| 688 | |||
| 689 | |||
| 690 | |||
| 691 | #define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ | 680 | #define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ |
| 692 | ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ | 681 | ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ |
| 693 | I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) | 682 | I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) |
| 694 | 683 | ||
| 695 | /* maximal length of item */ | 684 | /* maximal length of item */ |
| 696 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | 685 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) |
| 697 | #define MIN_ITEM_LEN 1 | 686 | #define MIN_ITEM_LEN 1 |
| 698 | 687 | ||
| 699 | |||
| 700 | /* object identifier for root dir */ | 688 | /* object identifier for root dir */ |
| 701 | #define REISERFS_ROOT_OBJECTID 2 | 689 | #define REISERFS_ROOT_OBJECTID 2 |
| 702 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | 690 | #define REISERFS_ROOT_PARENT_OBJECTID 1 |
| 703 | extern struct reiserfs_key root_key; | 691 | extern struct reiserfs_key root_key; |
| 704 | 692 | ||
| 705 | |||
| 706 | |||
| 707 | |||
| 708 | /* | 693 | /* |
| 709 | * Picture represents a leaf of the S+tree | 694 | * Picture represents a leaf of the S+tree |
| 710 | * ______________________________________________________ | 695 | * ______________________________________________________ |
| @@ -716,13 +701,13 @@ extern struct reiserfs_key root_key; | |||
| 716 | 701 | ||
| 717 | /* Header of a disk block. More precisely, header of a formatted leaf | 702 | /* Header of a disk block. More precisely, header of a formatted leaf |
| 718 | or internal node, and not the header of an unformatted node. */ | 703 | or internal node, and not the header of an unformatted node. */ |
| 719 | struct block_head { | 704 | struct block_head { |
| 720 | __le16 blk_level; /* Level of a block in the tree. */ | 705 | __le16 blk_level; /* Level of a block in the tree. */ |
| 721 | __le16 blk_nr_item; /* Number of keys/items in a block. */ | 706 | __le16 blk_nr_item; /* Number of keys/items in a block. */ |
| 722 | __le16 blk_free_space; /* Block free space in bytes. */ | 707 | __le16 blk_free_space; /* Block free space in bytes. */ |
| 723 | __le16 blk_reserved; | 708 | __le16 blk_reserved; |
| 724 | /* dump this in v4/planA */ | 709 | /* dump this in v4/planA */ |
| 725 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ | 710 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ |
| 726 | }; | 711 | }; |
| 727 | 712 | ||
| 728 | #define BLKH_SIZE (sizeof(struct block_head)) | 713 | #define BLKH_SIZE (sizeof(struct block_head)) |
| @@ -741,12 +726,12 @@ struct block_head { | |||
| 741 | * values for blk_level field of the struct block_head | 726 | * values for blk_level field of the struct block_head |
| 742 | */ | 727 | */ |
| 743 | 728 | ||
| 744 | #define FREE_LEVEL 0 /* when node gets removed from the tree its | 729 | #define FREE_LEVEL 0 /* when node gets removed from the tree its |
| 745 | blk_level is set to FREE_LEVEL. It is then | 730 | blk_level is set to FREE_LEVEL. It is then |
| 746 | used to see whether the node is still in the | 731 | used to see whether the node is still in the |
| 747 | tree */ | 732 | tree */ |
| 748 | 733 | ||
| 749 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level.*/ | 734 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ |
| 750 | 735 | ||
| 751 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | 736 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ |
| 752 | #define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) | 737 | #define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) |
| @@ -759,7 +744,6 @@ struct block_head { | |||
| 759 | #define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) | 744 | #define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) |
| 760 | #define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) | 745 | #define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) |
| 761 | 746 | ||
| 762 | |||
| 763 | /* Get right delimiting key. -- little endian */ | 747 | /* Get right delimiting key. -- little endian */ |
| 764 | #define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) | 748 | #define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) |
| 765 | 749 | ||
| @@ -770,41 +754,36 @@ struct block_head { | |||
| 770 | #define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ | 754 | #define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ |
| 771 | && B_LEVEL(p_s_bh) <= MAX_HEIGHT) | 755 | && B_LEVEL(p_s_bh) <= MAX_HEIGHT) |
| 772 | 756 | ||
| 773 | |||
| 774 | |||
| 775 | |||
| 776 | /***************************************************************************/ | 757 | /***************************************************************************/ |
| 777 | /* STAT DATA */ | 758 | /* STAT DATA */ |
| 778 | /***************************************************************************/ | 759 | /***************************************************************************/ |
| 779 | 760 | ||
| 780 | |||
| 781 | // | 761 | // |
| 782 | // old stat data is 32 bytes long. We are going to distinguish new one by | 762 | // old stat data is 32 bytes long. We are going to distinguish new one by |
| 783 | // different size | 763 | // different size |
| 784 | // | 764 | // |
| 785 | struct stat_data_v1 | 765 | struct stat_data_v1 { |
| 786 | { | 766 | __le16 sd_mode; /* file type, permissions */ |
| 787 | __le16 sd_mode; /* file type, permissions */ | 767 | __le16 sd_nlink; /* number of hard links */ |
| 788 | __le16 sd_nlink; /* number of hard links */ | 768 | __le16 sd_uid; /* owner */ |
| 789 | __le16 sd_uid; /* owner */ | 769 | __le16 sd_gid; /* group */ |
| 790 | __le16 sd_gid; /* group */ | 770 | __le32 sd_size; /* file size */ |
| 791 | __le32 sd_size; /* file size */ | 771 | __le32 sd_atime; /* time of last access */ |
| 792 | __le32 sd_atime; /* time of last access */ | 772 | __le32 sd_mtime; /* time file was last modified */ |
| 793 | __le32 sd_mtime; /* time file was last modified */ | 773 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ |
| 794 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | 774 | union { |
| 795 | union { | 775 | __le32 sd_rdev; |
| 796 | __le32 sd_rdev; | 776 | __le32 sd_blocks; /* number of blocks file uses */ |
| 797 | __le32 sd_blocks; /* number of blocks file uses */ | 777 | } __attribute__ ((__packed__)) u; |
| 798 | } __attribute__ ((__packed__)) u; | 778 | __le32 sd_first_direct_byte; /* first byte of file which is stored |
| 799 | __le32 sd_first_direct_byte; /* first byte of file which is stored | 779 | in a direct item: except that if it |
| 800 | in a direct item: except that if it | 780 | equals 1 it is a symlink and if it |
| 801 | equals 1 it is a symlink and if it | 781 | equals ~(__u32)0 there is no |
| 802 | equals ~(__u32)0 there is no | 782 | direct item. The existence of this |
| 803 | direct item. The existence of this | 783 | field really grates on me. Let's |
| 804 | field really grates on me. Let's | 784 | replace it with a macro based on |
| 805 | replace it with a macro based on | 785 | sd_size and our tail suppression |
| 806 | sd_size and our tail suppression | 786 | policy. Someday. -Hans */ |
| 807 | policy. Someday. -Hans */ | ||
| 808 | } __attribute__ ((__packed__)); | 787 | } __attribute__ ((__packed__)); |
| 809 | 788 | ||
| 810 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) | 789 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) |
| @@ -862,29 +841,29 @@ struct stat_data_v1 | |||
| 862 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the | 841 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the |
| 863 | address blocks) */ | 842 | address blocks) */ |
| 864 | struct stat_data { | 843 | struct stat_data { |
| 865 | __le16 sd_mode; /* file type, permissions */ | 844 | __le16 sd_mode; /* file type, permissions */ |
| 866 | __le16 sd_attrs; /* persistent inode flags */ | 845 | __le16 sd_attrs; /* persistent inode flags */ |
| 867 | __le32 sd_nlink; /* number of hard links */ | 846 | __le32 sd_nlink; /* number of hard links */ |
| 868 | __le64 sd_size; /* file size */ | 847 | __le64 sd_size; /* file size */ |
| 869 | __le32 sd_uid; /* owner */ | 848 | __le32 sd_uid; /* owner */ |
| 870 | __le32 sd_gid; /* group */ | 849 | __le32 sd_gid; /* group */ |
| 871 | __le32 sd_atime; /* time of last access */ | 850 | __le32 sd_atime; /* time of last access */ |
| 872 | __le32 sd_mtime; /* time file was last modified */ | 851 | __le32 sd_mtime; /* time file was last modified */ |
| 873 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | 852 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ |
| 874 | __le32 sd_blocks; | 853 | __le32 sd_blocks; |
| 875 | union { | 854 | union { |
| 876 | __le32 sd_rdev; | 855 | __le32 sd_rdev; |
| 877 | __le32 sd_generation; | 856 | __le32 sd_generation; |
| 878 | //__le32 sd_first_direct_byte; | 857 | //__le32 sd_first_direct_byte; |
| 879 | /* first byte of file which is stored in a | 858 | /* first byte of file which is stored in a |
| 880 | direct item: except that if it equals 1 | 859 | direct item: except that if it equals 1 |
| 881 | it is a symlink and if it equals | 860 | it is a symlink and if it equals |
| 882 | ~(__u32)0 there is no direct item. The | 861 | ~(__u32)0 there is no direct item. The |
| 883 | existence of this field really grates | 862 | existence of this field really grates |
| 884 | on me. Let's replace it with a macro | 863 | on me. Let's replace it with a macro |
| 885 | based on sd_size and our tail | 864 | based on sd_size and our tail |
| 886 | suppression policy? */ | 865 | suppression policy? */ |
| 887 | } __attribute__ ((__packed__)) u; | 866 | } __attribute__ ((__packed__)) u; |
| 888 | } __attribute__ ((__packed__)); | 867 | } __attribute__ ((__packed__)); |
| 889 | // | 868 | // |
| 890 | // this is 44 bytes long | 869 | // this is 44 bytes long |
| @@ -919,7 +898,6 @@ struct stat_data { | |||
| 919 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) | 898 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) |
| 920 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) | 899 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) |
| 921 | 900 | ||
| 922 | |||
| 923 | /***************************************************************************/ | 901 | /***************************************************************************/ |
| 924 | /* DIRECTORY STRUCTURE */ | 902 | /* DIRECTORY STRUCTURE */ |
| 925 | /***************************************************************************/ | 903 | /***************************************************************************/ |
| @@ -954,17 +932,14 @@ struct stat_data { | |||
| 954 | /* NOT IMPLEMENTED: | 932 | /* NOT IMPLEMENTED: |
| 955 | Directory will someday contain stat data of object */ | 933 | Directory will someday contain stat data of object */ |
| 956 | 934 | ||
| 957 | 935 | struct reiserfs_de_head { | |
| 958 | 936 | __le32 deh_offset; /* third component of the directory entry key */ | |
| 959 | struct reiserfs_de_head | 937 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced |
| 960 | { | 938 | by directory entry */ |
| 961 | __le32 deh_offset; /* third component of the directory entry key */ | 939 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ |
| 962 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced | 940 | __le16 deh_location; /* offset of name in the whole item */ |
| 963 | by directory entry */ | 941 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether |
| 964 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ | 942 | entry is hidden (unlinked) */ |
| 965 | __le16 deh_location; /* offset of name in the whole item */ | ||
| 966 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether | ||
| 967 | entry is hidden (unlinked) */ | ||
| 968 | } __attribute__ ((__packed__)); | 943 | } __attribute__ ((__packed__)); |
| 969 | #define DEH_SIZE sizeof(struct reiserfs_de_head) | 944 | #define DEH_SIZE sizeof(struct reiserfs_de_head) |
| 970 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) | 945 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) |
| @@ -986,7 +961,7 @@ struct reiserfs_de_head | |||
| 986 | /* old format directories have this size when empty */ | 961 | /* old format directories have this size when empty */ |
| 987 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) | 962 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) |
| 988 | 963 | ||
| 989 | #define DEH_Statdata 0 /* not used now */ | 964 | #define DEH_Statdata 0 /* not used now */ |
| 990 | #define DEH_Visible 2 | 965 | #define DEH_Visible 2 |
| 991 | 966 | ||
| 992 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ | 967 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ |
| @@ -1023,10 +998,10 @@ struct reiserfs_de_head | |||
| 1023 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | 998 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) |
| 1024 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | 999 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) |
| 1025 | 1000 | ||
| 1026 | extern void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid, | 1001 | extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, |
| 1027 | __le32 par_dirid, __le32 par_objid); | 1002 | __le32 par_dirid, __le32 par_objid); |
| 1028 | extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, | 1003 | extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, |
| 1029 | __le32 par_dirid, __le32 par_objid); | 1004 | __le32 par_dirid, __le32 par_objid); |
| 1030 | 1005 | ||
| 1031 | /* array of the entry headers */ | 1006 | /* array of the entry headers */ |
| 1032 | /* get item body */ | 1007 | /* get item body */ |
| @@ -1043,53 +1018,48 @@ extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, | |||
| 1043 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ | 1018 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ |
| 1044 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) | 1019 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) |
| 1045 | */ | 1020 | */ |
| 1046 | static inline int entry_length (const struct buffer_head * bh, | 1021 | static inline int entry_length(const struct buffer_head *bh, |
| 1047 | const struct item_head * ih, int pos_in_item) | 1022 | const struct item_head *ih, int pos_in_item) |
| 1048 | { | 1023 | { |
| 1049 | struct reiserfs_de_head * deh; | 1024 | struct reiserfs_de_head *deh; |
| 1050 | 1025 | ||
| 1051 | deh = B_I_DEH (bh, ih) + pos_in_item; | 1026 | deh = B_I_DEH(bh, ih) + pos_in_item; |
| 1052 | if (pos_in_item) | 1027 | if (pos_in_item) |
| 1053 | return deh_location(deh-1) - deh_location(deh); | 1028 | return deh_location(deh - 1) - deh_location(deh); |
| 1054 | 1029 | ||
| 1055 | return ih_item_len(ih) - deh_location(deh); | 1030 | return ih_item_len(ih) - deh_location(deh); |
| 1056 | } | 1031 | } |
| 1057 | 1032 | ||
| 1058 | |||
| 1059 | |||
| 1060 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ | 1033 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ |
| 1061 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) | 1034 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) |
| 1062 | 1035 | ||
| 1063 | |||
| 1064 | /* name by bh, ih and entry_num */ | 1036 | /* name by bh, ih and entry_num */ |
| 1065 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) | 1037 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) |
| 1066 | 1038 | ||
| 1067 | // two entries per block (at least) | 1039 | // two entries per block (at least) |
| 1068 | #define REISERFS_MAX_NAME(block_size) 255 | 1040 | #define REISERFS_MAX_NAME(block_size) 255 |
| 1069 | 1041 | ||
| 1070 | |||
| 1071 | /* this structure is used for operations on directory entries. It is | 1042 | /* this structure is used for operations on directory entries. It is |
| 1072 | not a disk structure. */ | 1043 | not a disk structure. */ |
| 1073 | /* When reiserfs_find_entry or search_by_entry_key find directory | 1044 | /* When reiserfs_find_entry or search_by_entry_key find directory |
| 1074 | entry, they return filled reiserfs_dir_entry structure */ | 1045 | entry, they return filled reiserfs_dir_entry structure */ |
| 1075 | struct reiserfs_dir_entry | 1046 | struct reiserfs_dir_entry { |
| 1076 | { | 1047 | struct buffer_head *de_bh; |
| 1077 | struct buffer_head * de_bh; | 1048 | int de_item_num; |
| 1078 | int de_item_num; | 1049 | struct item_head *de_ih; |
| 1079 | struct item_head * de_ih; | 1050 | int de_entry_num; |
| 1080 | int de_entry_num; | 1051 | struct reiserfs_de_head *de_deh; |
| 1081 | struct reiserfs_de_head * de_deh; | 1052 | int de_entrylen; |
| 1082 | int de_entrylen; | 1053 | int de_namelen; |
| 1083 | int de_namelen; | 1054 | char *de_name; |
| 1084 | char * de_name; | 1055 | char *de_gen_number_bit_string; |
| 1085 | char * de_gen_number_bit_string; | 1056 | |
| 1086 | 1057 | __u32 de_dir_id; | |
| 1087 | __u32 de_dir_id; | 1058 | __u32 de_objectid; |
| 1088 | __u32 de_objectid; | 1059 | |
| 1089 | 1060 | struct cpu_key de_entry_key; | |
| 1090 | struct cpu_key de_entry_key; | ||
| 1091 | }; | 1061 | }; |
| 1092 | 1062 | ||
| 1093 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ | 1063 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ |
| 1094 | 1064 | ||
| 1095 | /* pointer to file name, stored in entry */ | 1065 | /* pointer to file name, stored in entry */ |
| @@ -1099,8 +1069,6 @@ struct reiserfs_dir_entry | |||
| 1099 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ | 1069 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ |
| 1100 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) | 1070 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) |
| 1101 | 1071 | ||
| 1102 | |||
| 1103 | |||
| 1104 | /* hash value occupies bits from 7 up to 30 */ | 1072 | /* hash value occupies bits from 7 up to 30 */ |
| 1105 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) | 1073 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) |
| 1106 | /* generation number occupies 7 bits starting from 0 up to 6 */ | 1074 | /* generation number occupies 7 bits starting from 0 up to 6 */ |
| @@ -1109,7 +1077,6 @@ struct reiserfs_dir_entry | |||
| 1109 | 1077 | ||
| 1110 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) | 1078 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) |
| 1111 | 1079 | ||
| 1112 | |||
| 1113 | /* | 1080 | /* |
| 1114 | * Picture represents an internal node of the reiserfs tree | 1081 | * Picture represents an internal node of the reiserfs tree |
| 1115 | * ______________________________________________________ | 1082 | * ______________________________________________________ |
| @@ -1125,9 +1092,9 @@ struct reiserfs_dir_entry | |||
| 1125 | /* Disk child pointer: The pointer from an internal node of the tree | 1092 | /* Disk child pointer: The pointer from an internal node of the tree |
| 1126 | to a node that is on disk. */ | 1093 | to a node that is on disk. */ |
| 1127 | struct disk_child { | 1094 | struct disk_child { |
| 1128 | __le32 dc_block_number; /* Disk child's block number. */ | 1095 | __le32 dc_block_number; /* Disk child's block number. */ |
| 1129 | __le16 dc_size; /* Disk child's used space. */ | 1096 | __le16 dc_size; /* Disk child's used space. */ |
| 1130 | __le16 dc_reserved; | 1097 | __le16 dc_reserved; |
| 1131 | }; | 1098 | }; |
| 1132 | 1099 | ||
| 1133 | #define DC_SIZE (sizeof(struct disk_child)) | 1100 | #define DC_SIZE (sizeof(struct disk_child)) |
| @@ -1144,7 +1111,7 @@ struct disk_child { | |||
| 1144 | #define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) | 1111 | #define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) |
| 1145 | #define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) | 1112 | #define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) |
| 1146 | 1113 | ||
| 1147 | /* maximal value of field child_size in structure disk_child */ | 1114 | /* maximal value of field child_size in structure disk_child */ |
| 1148 | /* child size is the combined size of all items and their headers */ | 1115 | /* child size is the combined size of all items and their headers */ |
| 1149 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) | 1116 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) |
| 1150 | 1117 | ||
| @@ -1159,7 +1126,6 @@ struct disk_child { | |||
| 1159 | /* PATH STRUCTURES AND DEFINES */ | 1126 | /* PATH STRUCTURES AND DEFINES */ |
| 1160 | /***************************************************************************/ | 1127 | /***************************************************************************/ |
| 1161 | 1128 | ||
| 1162 | |||
| 1163 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the | 1129 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the |
| 1164 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it | 1130 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it |
| 1165 | does not find them in the cache it reads them from disk. For each node search_by_key finds using | 1131 | does not find them in the cache it reads them from disk. For each node search_by_key finds using |
| @@ -1168,20 +1134,18 @@ struct disk_child { | |||
| 1168 | is looking through a leaf node bin_search will find the position of the item which has key either | 1134 | is looking through a leaf node bin_search will find the position of the item which has key either |
| 1169 | equal to given key, or which is the maximal key less than the given key. */ | 1135 | equal to given key, or which is the maximal key less than the given key. */ |
| 1170 | 1136 | ||
| 1171 | struct path_element { | 1137 | struct path_element { |
| 1172 | struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in the tree. */ | 1138 | struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */ |
| 1173 | int pe_position; /* Position in the tree node which is placed in the */ | 1139 | int pe_position; /* Position in the tree node which is placed in the */ |
| 1174 | /* buffer above. */ | 1140 | /* buffer above. */ |
| 1175 | }; | 1141 | }; |
| 1176 | 1142 | ||
| 1177 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ | 1143 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ |
| 1178 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ | 1144 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ |
| 1179 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ | 1145 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ |
| 1180 | |||
| 1181 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
| 1182 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
| 1183 | |||
| 1184 | 1146 | ||
| 1147 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
| 1148 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
| 1185 | 1149 | ||
| 1186 | /* We need to keep track of who the ancestors of nodes are. When we | 1150 | /* We need to keep track of who the ancestors of nodes are. When we |
| 1187 | perform a search we record which nodes were visited while | 1151 | perform a search we record which nodes were visited while |
| @@ -1200,14 +1164,14 @@ excessive effort to avoid disturbing the precious VFS code.:-( The | |||
| 1200 | gods only know how we are going to SMP the code that uses them. | 1164 | gods only know how we are going to SMP the code that uses them. |
| 1201 | znodes are the way! */ | 1165 | znodes are the way! */ |
| 1202 | 1166 | ||
| 1203 | #define PATH_READA 0x1 /* do read ahead */ | 1167 | #define PATH_READA 0x1 /* do read ahead */ |
| 1204 | #define PATH_READA_BACK 0x2 /* read backwards */ | 1168 | #define PATH_READA_BACK 0x2 /* read backwards */ |
| 1205 | 1169 | ||
| 1206 | struct path { | 1170 | struct path { |
| 1207 | int path_length; /* Length of the array above. */ | 1171 | int path_length; /* Length of the array above. */ |
| 1208 | int reada; | 1172 | int reada; |
| 1209 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ | 1173 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ |
| 1210 | int pos_in_item; | 1174 | int pos_in_item; |
| 1211 | }; | 1175 | }; |
| 1212 | 1176 | ||
| 1213 | #define pos_in_item(path) ((path)->pos_in_item) | 1177 | #define pos_in_item(path) ((path)->pos_in_item) |
| @@ -1224,25 +1188,23 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
| 1224 | /* Get position in the element at the path by path and path position. */ | 1188 | /* Get position in the element at the path by path and path position. */ |
| 1225 | #define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) | 1189 | #define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) |
| 1226 | 1190 | ||
| 1227 | |||
| 1228 | #define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) | 1191 | #define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) |
| 1229 | /* you know, to the person who didn't | 1192 | /* you know, to the person who didn't |
| 1230 | write this the macro name does not | 1193 | write this the macro name does not |
| 1231 | at first suggest what it does. | 1194 | at first suggest what it does. |
| 1232 | Maybe POSITION_FROM_PATH_END? Or | 1195 | Maybe POSITION_FROM_PATH_END? Or |
| 1233 | maybe we should just focus on | 1196 | maybe we should just focus on |
| 1234 | dumping paths... -Hans */ | 1197 | dumping paths... -Hans */ |
| 1235 | #define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) | 1198 | #define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) |
| 1236 | 1199 | ||
| 1237 | |||
| 1238 | #define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) | 1200 | #define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) |
| 1239 | 1201 | ||
| 1240 | /* in do_balance leaf has h == 0 in contrast with path structure, | 1202 | /* in do_balance leaf has h == 0 in contrast with path structure, |
| 1241 | where root has level == 0. That is why we need these defines */ | 1203 | where root has level == 0. That is why we need these defines */ |
| 1242 | #define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ | 1204 | #define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ |
| 1243 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | 1205 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ |
| 1244 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | 1206 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) |
| 1245 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | 1207 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ |
| 1246 | 1208 | ||
| 1247 | #define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) | 1209 | #define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) |
| 1248 | 1210 | ||
| @@ -1253,7 +1215,6 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
| 1253 | #define item_moved(ih,path) comp_items(ih, path) | 1215 | #define item_moved(ih,path) comp_items(ih, path) |
| 1254 | #define path_changed(ih,path) comp_items (ih, path) | 1216 | #define path_changed(ih,path) comp_items (ih, path) |
| 1255 | 1217 | ||
| 1256 | |||
| 1257 | /***************************************************************************/ | 1218 | /***************************************************************************/ |
| 1258 | /* MISC */ | 1219 | /* MISC */ |
| 1259 | /***************************************************************************/ | 1220 | /***************************************************************************/ |
| @@ -1272,30 +1233,26 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
| 1272 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset | 1233 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset |
| 1273 | #define U32_MAX (~(__u32)0) | 1234 | #define U32_MAX (~(__u32)0) |
| 1274 | 1235 | ||
| 1275 | static inline loff_t max_reiserfs_offset (struct inode * inode) | 1236 | static inline loff_t max_reiserfs_offset(struct inode *inode) |
| 1276 | { | 1237 | { |
| 1277 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) | 1238 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) |
| 1278 | return (loff_t)U32_MAX; | 1239 | return (loff_t) U32_MAX; |
| 1279 | 1240 | ||
| 1280 | return (loff_t)((~(__u64)0) >> 4); | 1241 | return (loff_t) ((~(__u64) 0) >> 4); |
| 1281 | } | 1242 | } |
| 1282 | 1243 | ||
| 1283 | |||
| 1284 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ | 1244 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ |
| 1285 | #define MAX_KEY_OBJECTID MAX_UL_INT | 1245 | #define MAX_KEY_OBJECTID MAX_UL_INT |
| 1286 | 1246 | ||
| 1287 | |||
| 1288 | #define MAX_B_NUM MAX_UL_INT | 1247 | #define MAX_B_NUM MAX_UL_INT |
| 1289 | #define MAX_FC_NUM MAX_US_INT | 1248 | #define MAX_FC_NUM MAX_US_INT |
| 1290 | 1249 | ||
| 1291 | |||
| 1292 | /* the purpose is to detect overflow of an unsigned short */ | 1250 | /* the purpose is to detect overflow of an unsigned short */ |
| 1293 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) | 1251 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) |
| 1294 | 1252 | ||
| 1295 | |||
| 1296 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ | 1253 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ |
| 1297 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ | 1254 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ |
| 1298 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ | 1255 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ |
| 1299 | 1256 | ||
| 1300 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) | 1257 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) |
| 1301 | #define get_generation(s) atomic_read (&fs_generation(s)) | 1258 | #define get_generation(s) atomic_read (&fs_generation(s)) |
| @@ -1303,7 +1260,6 @@ static inline loff_t max_reiserfs_offset (struct inode * inode) | |||
| 1303 | #define __fs_changed(gen,s) (gen != get_generation (s)) | 1260 | #define __fs_changed(gen,s) (gen != get_generation (s)) |
| 1304 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) | 1261 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) |
| 1305 | 1262 | ||
| 1306 | |||
| 1307 | /***************************************************************************/ | 1263 | /***************************************************************************/ |
| 1308 | /* FIXATE NODES */ | 1264 | /* FIXATE NODES */ |
| 1309 | /***************************************************************************/ | 1265 | /***************************************************************************/ |
| @@ -1324,38 +1280,34 @@ static inline loff_t max_reiserfs_offset (struct inode * inode) | |||
| 1324 | calculating what we can shift to neighbors and how many nodes we | 1280 | calculating what we can shift to neighbors and how many nodes we |
| 1325 | have to have if we do not any shiftings, if we shift to left/right | 1281 | have to have if we do not any shiftings, if we shift to left/right |
| 1326 | neighbor or to both. */ | 1282 | neighbor or to both. */ |
| 1327 | struct virtual_item | 1283 | struct virtual_item { |
| 1328 | { | 1284 | int vi_index; // index in the array of item operations |
| 1329 | int vi_index; // index in the array of item operations | 1285 | unsigned short vi_type; // left/right mergeability |
| 1330 | unsigned short vi_type; // left/right mergeability | 1286 | unsigned short vi_item_len; /* length of item that it will have after balancing */ |
| 1331 | unsigned short vi_item_len; /* length of item that it will have after balancing */ | 1287 | struct item_head *vi_ih; |
| 1332 | struct item_head * vi_ih; | 1288 | const char *vi_item; // body of item (old or new) |
| 1333 | const char * vi_item; // body of item (old or new) | 1289 | const void *vi_new_data; // 0 always but paste mode |
| 1334 | const void * vi_new_data; // 0 always but paste mode | 1290 | void *vi_uarea; // item specific area |
| 1335 | void * vi_uarea; // item specific area | ||
| 1336 | }; | 1291 | }; |
| 1337 | 1292 | ||
| 1338 | 1293 | struct virtual_node { | |
| 1339 | struct virtual_node | 1294 | char *vn_free_ptr; /* this is a pointer to the free space in the buffer */ |
| 1340 | { | 1295 | unsigned short vn_nr_item; /* number of items in virtual node */ |
| 1341 | char * vn_free_ptr; /* this is a pointer to the free space in the buffer */ | 1296 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ |
| 1342 | unsigned short vn_nr_item; /* number of items in virtual node */ | 1297 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ |
| 1343 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ | 1298 | short vn_affected_item_num; |
| 1344 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ | 1299 | short vn_pos_in_item; |
| 1345 | short vn_affected_item_num; | 1300 | struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */ |
| 1346 | short vn_pos_in_item; | 1301 | const void *vn_data; |
| 1347 | struct item_head * vn_ins_ih; /* item header of inserted item, 0 for other modes */ | 1302 | struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */ |
| 1348 | const void * vn_data; | ||
| 1349 | struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */ | ||
| 1350 | }; | 1303 | }; |
| 1351 | 1304 | ||
| 1352 | /* used by directory items when creating virtual nodes */ | 1305 | /* used by directory items when creating virtual nodes */ |
| 1353 | struct direntry_uarea { | 1306 | struct direntry_uarea { |
| 1354 | int flags; | 1307 | int flags; |
| 1355 | __u16 entry_count; | 1308 | __u16 entry_count; |
| 1356 | __u16 entry_sizes[1]; | 1309 | __u16 entry_sizes[1]; |
| 1357 | } __attribute__ ((__packed__)) ; | 1310 | } __attribute__ ((__packed__)); |
| 1358 | |||
| 1359 | 1311 | ||
| 1360 | /***************************************************************************/ | 1312 | /***************************************************************************/ |
| 1361 | /* TREE BALANCE */ | 1313 | /* TREE BALANCE */ |
| @@ -1378,73 +1330,72 @@ struct direntry_uarea { | |||
| 1378 | #define MAX_AMOUNT_NEEDED 2 | 1330 | #define MAX_AMOUNT_NEEDED 2 |
| 1379 | 1331 | ||
| 1380 | /* someday somebody will prefix every field in this struct with tb_ */ | 1332 | /* someday somebody will prefix every field in this struct with tb_ */ |
| 1381 | struct tree_balance | 1333 | struct tree_balance { |
| 1382 | { | 1334 | int tb_mode; |
| 1383 | int tb_mode; | 1335 | int need_balance_dirty; |
| 1384 | int need_balance_dirty; | 1336 | struct super_block *tb_sb; |
| 1385 | struct super_block * tb_sb; | 1337 | struct reiserfs_transaction_handle *transaction_handle; |
| 1386 | struct reiserfs_transaction_handle *transaction_handle ; | 1338 | struct path *tb_path; |
| 1387 | struct path * tb_path; | 1339 | struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ |
| 1388 | struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ | 1340 | struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */ |
| 1389 | struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/ | 1341 | struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ |
| 1390 | struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ | 1342 | struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ |
| 1391 | struct buffer_head * FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ | 1343 | struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ |
| 1392 | struct buffer_head * CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ | 1344 | struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ |
| 1393 | struct buffer_head * CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ | 1345 | |
| 1394 | 1346 | struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | |
| 1395 | struct buffer_head * FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | 1347 | cur_blknum. */ |
| 1396 | cur_blknum. */ | 1348 | struct buffer_head *used[MAX_FEB_SIZE]; |
| 1397 | struct buffer_head * used[MAX_FEB_SIZE]; | 1349 | struct buffer_head *thrown[MAX_FEB_SIZE]; |
| 1398 | struct buffer_head * thrown[MAX_FEB_SIZE]; | 1350 | int lnum[MAX_HEIGHT]; /* array of number of items which must be |
| 1399 | int lnum[MAX_HEIGHT]; /* array of number of items which must be | 1351 | shifted to the left in order to balance the |
| 1400 | shifted to the left in order to balance the | 1352 | current node; for leaves includes item that |
| 1401 | current node; for leaves includes item that | 1353 | will be partially shifted; for internal |
| 1402 | will be partially shifted; for internal | 1354 | nodes, it is the number of child pointers |
| 1403 | nodes, it is the number of child pointers | 1355 | rather than items. It includes the new item |
| 1404 | rather than items. It includes the new item | 1356 | being created. The code sometimes subtracts |
| 1405 | being created. The code sometimes subtracts | 1357 | one to get the number of wholly shifted |
| 1406 | one to get the number of wholly shifted | 1358 | items for other purposes. */ |
| 1407 | items for other purposes. */ | 1359 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ |
| 1408 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ | 1360 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and |
| 1409 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and | 1361 | S[h] to its item number within the node CFL[h] */ |
| 1410 | S[h] to its item number within the node CFL[h] */ | 1362 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ |
| 1411 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ | 1363 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from |
| 1412 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from | 1364 | S[h]. A negative value means removing. */ |
| 1413 | S[h]. A negative value means removing. */ | 1365 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after |
| 1414 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after | 1366 | balancing on the level h of the tree. If 0 then S is |
| 1415 | balancing on the level h of the tree. If 0 then S is | 1367 | being deleted, if 1 then S is remaining and no new nodes |
| 1416 | being deleted, if 1 then S is remaining and no new nodes | 1368 | are being created, if 2 or 3 then 1 or 2 new nodes is |
| 1417 | are being created, if 2 or 3 then 1 or 2 new nodes is | 1369 | being created */ |
| 1418 | being created */ | 1370 | |
| 1419 | 1371 | /* fields that are used only for balancing leaves of the tree */ | |
| 1420 | /* fields that are used only for balancing leaves of the tree */ | 1372 | int cur_blknum; /* number of empty blocks having been already allocated */ |
| 1421 | int cur_blknum; /* number of empty blocks having been already allocated */ | 1373 | int s0num; /* number of items that fall into left most node when S[0] splits */ |
| 1422 | int s0num; /* number of items that fall into left most node when S[0] splits */ | 1374 | int s1num; /* number of items that fall into first new node when S[0] splits */ |
| 1423 | int s1num; /* number of items that fall into first new node when S[0] splits */ | 1375 | int s2num; /* number of items that fall into second new node when S[0] splits */ |
| 1424 | int s2num; /* number of items that fall into second new node when S[0] splits */ | 1376 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ |
| 1425 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ | 1377 | /* most liquid item that cannot be shifted from S[0] entirely */ |
| 1426 | /* most liquid item that cannot be shifted from S[0] entirely */ | 1378 | /* if -1 then nothing will be partially shifted */ |
| 1427 | /* if -1 then nothing will be partially shifted */ | 1379 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ |
| 1428 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ | 1380 | /* most liquid item that cannot be shifted from S[0] entirely */ |
| 1429 | /* most liquid item that cannot be shifted from S[0] entirely */ | 1381 | /* if -1 then nothing will be partially shifted */ |
| 1430 | /* if -1 then nothing will be partially shifted */ | 1382 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ |
| 1431 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ | 1383 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ |
| 1432 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ | 1384 | int s2bytes; |
| 1433 | int s2bytes; | 1385 | struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ |
| 1434 | struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ | 1386 | char *vn_buf; /* kmalloced memory. Used to create |
| 1435 | char * vn_buf; /* kmalloced memory. Used to create | ||
| 1436 | virtual node and keep map of | 1387 | virtual node and keep map of |
| 1437 | dirtied bitmap blocks */ | 1388 | dirtied bitmap blocks */ |
| 1438 | int vn_buf_size; /* size of the vn_buf */ | 1389 | int vn_buf_size; /* size of the vn_buf */ |
| 1439 | struct virtual_node * tb_vn; /* VN starts after bitmap of bitmap blocks */ | 1390 | struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */ |
| 1440 | 1391 | ||
| 1441 | int fs_gen; /* saved value of `reiserfs_generation' counter | 1392 | int fs_gen; /* saved value of `reiserfs_generation' counter |
| 1442 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ | 1393 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ |
| 1443 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | 1394 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES |
| 1444 | struct in_core_key key; /* key pointer, to pass to block allocator or | 1395 | struct in_core_key key; /* key pointer, to pass to block allocator or |
| 1445 | another low-level subsystem */ | 1396 | another low-level subsystem */ |
| 1446 | #endif | 1397 | #endif |
| 1447 | } ; | 1398 | }; |
| 1448 | 1399 | ||
| 1449 | /* These are modes of balancing */ | 1400 | /* These are modes of balancing */ |
| 1450 | 1401 | ||
| @@ -1479,13 +1430,12 @@ struct tree_balance | |||
| 1479 | /* used in do_balance for passing parent of node information that has | 1430 | /* used in do_balance for passing parent of node information that has |
| 1480 | been gotten from tb struct */ | 1431 | been gotten from tb struct */ |
| 1481 | struct buffer_info { | 1432 | struct buffer_info { |
| 1482 | struct tree_balance * tb; | 1433 | struct tree_balance *tb; |
| 1483 | struct buffer_head * bi_bh; | 1434 | struct buffer_head *bi_bh; |
| 1484 | struct buffer_head * bi_parent; | 1435 | struct buffer_head *bi_parent; |
| 1485 | int bi_position; | 1436 | int bi_position; |
| 1486 | }; | 1437 | }; |
| 1487 | 1438 | ||
| 1488 | |||
| 1489 | /* there are 4 types of items: stat data, directory item, indirect, direct. | 1439 | /* there are 4 types of items: stat data, directory item, indirect, direct. |
| 1490 | +-------------------+------------+--------------+------------+ | 1440 | +-------------------+------------+--------------+------------+ |
| 1491 | | | k_offset | k_uniqueness | mergeable? | | 1441 | | | k_offset | k_uniqueness | mergeable? | |
| @@ -1503,24 +1453,24 @@ struct buffer_info { | |||
| 1503 | */ | 1453 | */ |
| 1504 | 1454 | ||
| 1505 | struct item_operations { | 1455 | struct item_operations { |
| 1506 | int (*bytes_number) (struct item_head * ih, int block_size); | 1456 | int (*bytes_number) (struct item_head * ih, int block_size); |
| 1507 | void (*decrement_key) (struct cpu_key *); | 1457 | void (*decrement_key) (struct cpu_key *); |
| 1508 | int (*is_left_mergeable) (struct reiserfs_key * ih, unsigned long bsize); | 1458 | int (*is_left_mergeable) (struct reiserfs_key * ih, |
| 1509 | void (*print_item) (struct item_head *, char * item); | 1459 | unsigned long bsize); |
| 1510 | void (*check_item) (struct item_head *, char * item); | 1460 | void (*print_item) (struct item_head *, char *item); |
| 1511 | 1461 | void (*check_item) (struct item_head *, char *item); | |
| 1512 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, | 1462 | |
| 1513 | int is_affected, int insert_size); | 1463 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, |
| 1514 | int (*check_left) (struct virtual_item * vi, int free, | 1464 | int is_affected, int insert_size); |
| 1515 | int start_skip, int end_skip); | 1465 | int (*check_left) (struct virtual_item * vi, int free, |
| 1516 | int (*check_right) (struct virtual_item * vi, int free); | 1466 | int start_skip, int end_skip); |
| 1517 | int (*part_size) (struct virtual_item * vi, int from, int to); | 1467 | int (*check_right) (struct virtual_item * vi, int free); |
| 1518 | int (*unit_num) (struct virtual_item * vi); | 1468 | int (*part_size) (struct virtual_item * vi, int from, int to); |
| 1519 | void (*print_vi) (struct virtual_item * vi); | 1469 | int (*unit_num) (struct virtual_item * vi); |
| 1470 | void (*print_vi) (struct virtual_item * vi); | ||
| 1520 | }; | 1471 | }; |
| 1521 | 1472 | ||
| 1522 | 1473 | extern struct item_operations *item_ops[TYPE_ANY + 1]; | |
| 1523 | extern struct item_operations * item_ops [TYPE_ANY + 1]; | ||
| 1524 | 1474 | ||
| 1525 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) | 1475 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) |
| 1526 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) | 1476 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) |
| @@ -1533,8 +1483,6 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
| 1533 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) | 1483 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) |
| 1534 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) | 1484 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) |
| 1535 | 1485 | ||
| 1536 | |||
| 1537 | |||
| 1538 | #define COMP_SHORT_KEYS comp_short_keys | 1486 | #define COMP_SHORT_KEYS comp_short_keys |
| 1539 | 1487 | ||
| 1540 | /* number of blocks pointed to by the indirect item */ | 1488 | /* number of blocks pointed to by the indirect item */ |
| @@ -1545,8 +1493,7 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
| 1545 | 1493 | ||
| 1546 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ | 1494 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ |
| 1547 | 1495 | ||
| 1548 | 1496 | /* get the item header */ | |
| 1549 | /* get the item header */ | ||
| 1550 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | 1497 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) |
| 1551 | 1498 | ||
| 1552 | /* get key */ | 1499 | /* get key */ |
| @@ -1577,9 +1524,9 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
| 1577 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) | 1524 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) |
| 1578 | 1525 | ||
| 1579 | struct reiserfs_iget_args { | 1526 | struct reiserfs_iget_args { |
| 1580 | __u32 objectid ; | 1527 | __u32 objectid; |
| 1581 | __u32 dirid ; | 1528 | __u32 dirid; |
| 1582 | } ; | 1529 | }; |
| 1583 | 1530 | ||
| 1584 | /***************************************************************************/ | 1531 | /***************************************************************************/ |
| 1585 | /* FUNCTION DECLARATIONS */ | 1532 | /* FUNCTION DECLARATIONS */ |
| @@ -1595,11 +1542,11 @@ struct reiserfs_iget_args { | |||
| 1595 | 1542 | ||
| 1596 | /* first block written in a commit. */ | 1543 | /* first block written in a commit. */ |
| 1597 | struct reiserfs_journal_desc { | 1544 | struct reiserfs_journal_desc { |
| 1598 | __le32 j_trans_id ; /* id of commit */ | 1545 | __le32 j_trans_id; /* id of commit */ |
| 1599 | __le32 j_len ; /* length of commit. len +1 is the commit block */ | 1546 | __le32 j_len; /* length of commit. len +1 is the commit block */ |
| 1600 | __le32 j_mount_id ; /* mount id of this trans*/ | 1547 | __le32 j_mount_id; /* mount id of this trans */ |
| 1601 | __le32 j_realblock[1] ; /* real locations for each block */ | 1548 | __le32 j_realblock[1]; /* real locations for each block */ |
| 1602 | } ; | 1549 | }; |
| 1603 | 1550 | ||
| 1604 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) | 1551 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) |
| 1605 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) | 1552 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) |
| @@ -1611,10 +1558,10 @@ struct reiserfs_journal_desc { | |||
| 1611 | 1558 | ||
| 1612 | /* last block written in a commit */ | 1559 | /* last block written in a commit */ |
| 1613 | struct reiserfs_journal_commit { | 1560 | struct reiserfs_journal_commit { |
| 1614 | __le32 j_trans_id ; /* must match j_trans_id from the desc block */ | 1561 | __le32 j_trans_id; /* must match j_trans_id from the desc block */ |
| 1615 | __le32 j_len ; /* ditto */ | 1562 | __le32 j_len; /* ditto */ |
| 1616 | __le32 j_realblock[1] ; /* real locations for each block */ | 1563 | __le32 j_realblock[1]; /* real locations for each block */ |
| 1617 | } ; | 1564 | }; |
| 1618 | 1565 | ||
| 1619 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) | 1566 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) |
| 1620 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) | 1567 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) |
| @@ -1628,19 +1575,19 @@ struct reiserfs_journal_commit { | |||
| 1628 | ** and this transaction does not need to be replayed. | 1575 | ** and this transaction does not need to be replayed. |
| 1629 | */ | 1576 | */ |
| 1630 | struct reiserfs_journal_header { | 1577 | struct reiserfs_journal_header { |
| 1631 | __le32 j_last_flush_trans_id ; /* id of last fully flushed transaction */ | 1578 | __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */ |
| 1632 | __le32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */ | 1579 | __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ |
| 1633 | __le32 j_mount_id ; | 1580 | __le32 j_mount_id; |
| 1634 | /* 12 */ struct journal_params jh_journal; | 1581 | /* 12 */ struct journal_params jh_journal; |
| 1635 | } ; | 1582 | }; |
| 1636 | 1583 | ||
| 1637 | /* biggest tunable defines are right here */ | 1584 | /* biggest tunable defines are right here */ |
| 1638 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ | 1585 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ |
| 1639 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ | 1586 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ |
| 1640 | #define JOURNAL_TRANS_MIN_DEFAULT 256 | 1587 | #define JOURNAL_TRANS_MIN_DEFAULT 256 |
| 1641 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ | 1588 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ |
| 1642 | #define JOURNAL_MIN_RATIO 2 | 1589 | #define JOURNAL_MIN_RATIO 2 |
| 1643 | #define JOURNAL_MAX_COMMIT_AGE 30 | 1590 | #define JOURNAL_MAX_COMMIT_AGE 30 |
| 1644 | #define JOURNAL_MAX_TRANS_AGE 30 | 1591 | #define JOURNAL_MAX_TRANS_AGE 30 |
| 1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | 1592 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) |
| 1646 | #ifdef CONFIG_QUOTA | 1593 | #ifdef CONFIG_QUOTA |
| @@ -1664,10 +1611,10 @@ struct reiserfs_journal_header { | |||
| 1664 | ** the current number of nodes is > max, the node is freed, otherwise, | 1611 | ** the current number of nodes is > max, the node is freed, otherwise, |
| 1665 | ** it is put on a free list for faster use later. | 1612 | ** it is put on a free list for faster use later. |
| 1666 | */ | 1613 | */ |
| 1667 | #define REISERFS_MIN_BITMAP_NODES 10 | 1614 | #define REISERFS_MIN_BITMAP_NODES 10 |
| 1668 | #define REISERFS_MAX_BITMAP_NODES 100 | 1615 | #define REISERFS_MAX_BITMAP_NODES 100 |
| 1669 | 1616 | ||
| 1670 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ | 1617 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ |
| 1671 | #define JBH_HASH_MASK 8191 | 1618 | #define JBH_HASH_MASK 8191 |
| 1672 | 1619 | ||
| 1673 | #define _jhashfn(sb,block) \ | 1620 | #define _jhashfn(sb,block) \ |
| @@ -1681,14 +1628,14 @@ struct reiserfs_journal_header { | |||
| 1681 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | 1628 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) |
| 1682 | 1629 | ||
| 1683 | enum reiserfs_bh_state_bits { | 1630 | enum reiserfs_bh_state_bits { |
| 1684 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ | 1631 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ |
| 1685 | BH_JDirty_wait, | 1632 | BH_JDirty_wait, |
| 1686 | BH_JNew, /* disk block was taken off free list before | 1633 | BH_JNew, /* disk block was taken off free list before |
| 1687 | * being in a finished transaction, or | 1634 | * being in a finished transaction, or |
| 1688 | * written to disk. Can be reused immed. */ | 1635 | * written to disk. Can be reused immed. */ |
| 1689 | BH_JPrepared, | 1636 | BH_JPrepared, |
| 1690 | BH_JRestore_dirty, | 1637 | BH_JRestore_dirty, |
| 1691 | BH_JTest, // debugging only will go away | 1638 | BH_JTest, // debugging only will go away |
| 1692 | }; | 1639 | }; |
| 1693 | 1640 | ||
| 1694 | BUFFER_FNS(JDirty, journaled); | 1641 | BUFFER_FNS(JDirty, journaled); |
| @@ -1708,175 +1655,192 @@ TAS_BUFFER_FNS(JTest, journal_test); | |||
| 1708 | ** transaction handle which is passed around for all journal calls | 1655 | ** transaction handle which is passed around for all journal calls |
| 1709 | */ | 1656 | */ |
| 1710 | struct reiserfs_transaction_handle { | 1657 | struct reiserfs_transaction_handle { |
| 1711 | struct super_block *t_super ; /* super for this FS when journal_begin was | 1658 | struct super_block *t_super; /* super for this FS when journal_begin was |
| 1712 | called. saves calls to reiserfs_get_super | 1659 | called. saves calls to reiserfs_get_super |
| 1713 | also used by nested transactions to make | 1660 | also used by nested transactions to make |
| 1714 | sure they are nesting on the right FS | 1661 | sure they are nesting on the right FS |
| 1715 | _must_ be first in the handle | 1662 | _must_ be first in the handle |
| 1716 | */ | 1663 | */ |
| 1717 | int t_refcount; | 1664 | int t_refcount; |
| 1718 | int t_blocks_logged ; /* number of blocks this writer has logged */ | 1665 | int t_blocks_logged; /* number of blocks this writer has logged */ |
| 1719 | int t_blocks_allocated ; /* number of blocks this writer allocated */ | 1666 | int t_blocks_allocated; /* number of blocks this writer allocated */ |
| 1720 | unsigned long t_trans_id ; /* sanity check, equals the current trans id */ | 1667 | unsigned long t_trans_id; /* sanity check, equals the current trans id */ |
| 1721 | void *t_handle_save ; /* save existing current->journal_info */ | 1668 | void *t_handle_save; /* save existing current->journal_info */ |
| 1722 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | 1669 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block |
| 1723 | should be displaced from others */ | 1670 | should be displaced from others */ |
| 1724 | struct list_head t_list; | 1671 | struct list_head t_list; |
| 1725 | } ; | 1672 | }; |
| 1726 | 1673 | ||
| 1727 | /* used to keep track of ordered and tail writes, attached to the buffer | 1674 | /* used to keep track of ordered and tail writes, attached to the buffer |
| 1728 | * head through b_journal_head. | 1675 | * head through b_journal_head. |
| 1729 | */ | 1676 | */ |
| 1730 | struct reiserfs_jh { | 1677 | struct reiserfs_jh { |
| 1731 | struct reiserfs_journal_list *jl; | 1678 | struct reiserfs_journal_list *jl; |
| 1732 | struct buffer_head *bh; | 1679 | struct buffer_head *bh; |
| 1733 | struct list_head list; | 1680 | struct list_head list; |
| 1734 | }; | 1681 | }; |
| 1735 | 1682 | ||
| 1736 | void reiserfs_free_jh(struct buffer_head *bh); | 1683 | void reiserfs_free_jh(struct buffer_head *bh); |
| 1737 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); | 1684 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); |
| 1738 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); | 1685 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); |
| 1739 | int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; | 1686 | int journal_mark_dirty(struct reiserfs_transaction_handle *, |
| 1740 | 1687 | struct super_block *, struct buffer_head *bh); | |
| 1741 | static inline int | 1688 | |
| 1742 | reiserfs_file_data_log(struct inode *inode) { | 1689 | static inline int reiserfs_file_data_log(struct inode *inode) |
| 1743 | if (reiserfs_data_log(inode->i_sb) || | 1690 | { |
| 1744 | (REISERFS_I(inode)->i_flags & i_data_log)) | 1691 | if (reiserfs_data_log(inode->i_sb) || |
| 1745 | return 1 ; | 1692 | (REISERFS_I(inode)->i_flags & i_data_log)) |
| 1746 | return 0 ; | 1693 | return 1; |
| 1694 | return 0; | ||
| 1747 | } | 1695 | } |
| 1748 | 1696 | ||
| 1749 | static inline int reiserfs_transaction_running(struct super_block *s) { | 1697 | static inline int reiserfs_transaction_running(struct super_block *s) |
| 1750 | struct reiserfs_transaction_handle *th = current->journal_info ; | 1698 | { |
| 1751 | if (th && th->t_super == s) | 1699 | struct reiserfs_transaction_handle *th = current->journal_info; |
| 1752 | return 1 ; | 1700 | if (th && th->t_super == s) |
| 1753 | if (th && th->t_super == NULL) | 1701 | return 1; |
| 1754 | BUG(); | 1702 | if (th && th->t_super == NULL) |
| 1755 | return 0 ; | 1703 | BUG(); |
| 1704 | return 0; | ||
| 1756 | } | 1705 | } |
| 1757 | 1706 | ||
| 1758 | int reiserfs_async_progress_wait(struct super_block *s); | 1707 | int reiserfs_async_progress_wait(struct super_block *s); |
| 1759 | 1708 | ||
| 1760 | struct reiserfs_transaction_handle * | 1709 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct |
| 1761 | reiserfs_persistent_transaction(struct super_block *, int count); | 1710 | super_block |
| 1711 | *, | ||
| 1712 | int count); | ||
| 1762 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | 1713 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); |
| 1763 | int reiserfs_commit_page(struct inode *inode, struct page *page, | 1714 | int reiserfs_commit_page(struct inode *inode, struct page *page, |
| 1764 | unsigned from, unsigned to); | 1715 | unsigned from, unsigned to); |
| 1765 | int reiserfs_flush_old_commits(struct super_block *); | 1716 | int reiserfs_flush_old_commits(struct super_block *); |
| 1766 | int reiserfs_commit_for_inode(struct inode *) ; | 1717 | int reiserfs_commit_for_inode(struct inode *); |
| 1767 | int reiserfs_inode_needs_commit(struct inode *) ; | 1718 | int reiserfs_inode_needs_commit(struct inode *); |
| 1768 | void reiserfs_update_inode_transaction(struct inode *) ; | 1719 | void reiserfs_update_inode_transaction(struct inode *); |
| 1769 | void reiserfs_wait_on_write_block(struct super_block *s) ; | 1720 | void reiserfs_wait_on_write_block(struct super_block *s); |
| 1770 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; | 1721 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th); |
| 1771 | void reiserfs_allow_writes(struct super_block *s) ; | 1722 | void reiserfs_allow_writes(struct super_block *s); |
| 1772 | void reiserfs_check_lock_depth(struct super_block *s, char *caller) ; | 1723 | void reiserfs_check_lock_depth(struct super_block *s, char *caller); |
| 1773 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; | 1724 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, |
| 1774 | void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ; | 1725 | int wait); |
| 1775 | int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ; | 1726 | void reiserfs_restore_prepared_buffer(struct super_block *, |
| 1776 | int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ; | 1727 | struct buffer_head *bh); |
| 1777 | int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ; | 1728 | int journal_init(struct super_block *, const char *j_dev_name, int old_format, |
| 1778 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; | 1729 | unsigned int); |
| 1779 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; | 1730 | int journal_release(struct reiserfs_transaction_handle *, struct super_block *); |
| 1780 | int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ; | 1731 | int journal_release_error(struct reiserfs_transaction_handle *, |
| 1781 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ; | 1732 | struct super_block *); |
| 1782 | int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ; | 1733 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, |
| 1783 | int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; | 1734 | unsigned long); |
| 1784 | int journal_join_abort(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; | 1735 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, |
| 1785 | void reiserfs_journal_abort (struct super_block *sb, int errno); | 1736 | unsigned long); |
| 1786 | void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...); | 1737 | int journal_mark_freed(struct reiserfs_transaction_handle *, |
| 1787 | int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ; | 1738 | struct super_block *, b_blocknr_t blocknr); |
| 1788 | 1739 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | |
| 1789 | void add_save_link (struct reiserfs_transaction_handle * th, | 1740 | int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, |
| 1790 | struct inode * inode, int truncate); | 1741 | int searchall, b_blocknr_t * next); |
| 1791 | int remove_save_link (struct inode * inode, int truncate); | 1742 | int journal_begin(struct reiserfs_transaction_handle *, |
| 1743 | struct super_block *p_s_sb, unsigned long); | ||
| 1744 | int journal_join_abort(struct reiserfs_transaction_handle *, | ||
| 1745 | struct super_block *p_s_sb, unsigned long); | ||
| 1746 | void reiserfs_journal_abort(struct super_block *sb, int errno); | ||
| 1747 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | ||
| 1748 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | ||
| 1749 | struct reiserfs_list_bitmap *, int); | ||
| 1750 | |||
| 1751 | void add_save_link(struct reiserfs_transaction_handle *th, | ||
| 1752 | struct inode *inode, int truncate); | ||
| 1753 | int remove_save_link(struct inode *inode, int truncate); | ||
| 1792 | 1754 | ||
| 1793 | /* objectid.c */ | 1755 | /* objectid.c */ |
| 1794 | __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th); | 1756 | __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th); |
| 1795 | void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release); | 1757 | void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, |
| 1796 | int reiserfs_convert_objectid_map_v1(struct super_block *) ; | 1758 | __u32 objectid_to_release); |
| 1759 | int reiserfs_convert_objectid_map_v1(struct super_block *); | ||
| 1797 | 1760 | ||
| 1798 | /* stree.c */ | 1761 | /* stree.c */ |
| 1799 | int B_IS_IN_TREE(const struct buffer_head *); | 1762 | int B_IS_IN_TREE(const struct buffer_head *); |
| 1800 | extern void copy_item_head(struct item_head * p_v_to, | 1763 | extern void copy_item_head(struct item_head *p_v_to, |
| 1801 | const struct item_head * p_v_from); | 1764 | const struct item_head *p_v_from); |
| 1802 | 1765 | ||
| 1803 | // first key is in cpu form, second - le | 1766 | // first key is in cpu form, second - le |
| 1804 | extern int comp_short_keys (const struct reiserfs_key * le_key, | 1767 | extern int comp_short_keys(const struct reiserfs_key *le_key, |
| 1805 | const struct cpu_key * cpu_key); | 1768 | const struct cpu_key *cpu_key); |
| 1806 | extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from); | 1769 | extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from); |
| 1807 | 1770 | ||
| 1808 | // both are in le form | 1771 | // both are in le form |
| 1809 | extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); | 1772 | extern int comp_le_keys(const struct reiserfs_key *, |
| 1810 | extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); | 1773 | const struct reiserfs_key *); |
| 1774 | extern int comp_short_le_keys(const struct reiserfs_key *, | ||
| 1775 | const struct reiserfs_key *); | ||
| 1811 | 1776 | ||
| 1812 | // | 1777 | // |
| 1813 | // get key version from on disk key - kludge | 1778 | // get key version from on disk key - kludge |
| 1814 | // | 1779 | // |
| 1815 | static inline int le_key_version (const struct reiserfs_key * key) | 1780 | static inline int le_key_version(const struct reiserfs_key *key) |
| 1816 | { | 1781 | { |
| 1817 | int type; | 1782 | int type; |
| 1818 | |||
| 1819 | type = offset_v2_k_type( &(key->u.k_offset_v2)); | ||
| 1820 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT && type != TYPE_DIRENTRY) | ||
| 1821 | return KEY_FORMAT_3_5; | ||
| 1822 | |||
| 1823 | return KEY_FORMAT_3_6; | ||
| 1824 | |||
| 1825 | } | ||
| 1826 | 1783 | ||
| 1784 | type = offset_v2_k_type(&(key->u.k_offset_v2)); | ||
| 1785 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT | ||
| 1786 | && type != TYPE_DIRENTRY) | ||
| 1787 | return KEY_FORMAT_3_5; | ||
| 1788 | |||
| 1789 | return KEY_FORMAT_3_6; | ||
| 1827 | 1790 | ||
| 1828 | static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key *from) | ||
| 1829 | { | ||
| 1830 | memcpy (to, from, KEY_SIZE); | ||
| 1831 | } | 1791 | } |
| 1832 | 1792 | ||
| 1793 | static inline void copy_key(struct reiserfs_key *to, | ||
| 1794 | const struct reiserfs_key *from) | ||
| 1795 | { | ||
| 1796 | memcpy(to, from, KEY_SIZE); | ||
| 1797 | } | ||
| 1833 | 1798 | ||
| 1834 | int comp_items (const struct item_head * stored_ih, const struct path * p_s_path); | 1799 | int comp_items(const struct item_head *stored_ih, const struct path *p_s_path); |
| 1835 | const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path, | 1800 | const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path, |
| 1836 | const struct super_block * p_s_sb); | 1801 | const struct super_block *p_s_sb); |
| 1837 | int search_by_key (struct super_block *, const struct cpu_key *, | 1802 | int search_by_key(struct super_block *, const struct cpu_key *, |
| 1838 | struct path *, int); | 1803 | struct path *, int); |
| 1839 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | 1804 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) |
| 1840 | int search_for_position_by_key (struct super_block * p_s_sb, | 1805 | int search_for_position_by_key(struct super_block *p_s_sb, |
| 1841 | const struct cpu_key * p_s_cpu_key, | 1806 | const struct cpu_key *p_s_cpu_key, |
| 1842 | struct path * p_s_search_path); | 1807 | struct path *p_s_search_path); |
| 1843 | extern void decrement_bcount (struct buffer_head * p_s_bh); | 1808 | extern void decrement_bcount(struct buffer_head *p_s_bh); |
| 1844 | void decrement_counters_in_path (struct path * p_s_search_path); | 1809 | void decrement_counters_in_path(struct path *p_s_search_path); |
| 1845 | void pathrelse (struct path * p_s_search_path); | 1810 | void pathrelse(struct path *p_s_search_path); |
| 1846 | int reiserfs_check_path(struct path *p) ; | 1811 | int reiserfs_check_path(struct path *p); |
| 1847 | void pathrelse_and_restore (struct super_block *s, struct path * p_s_search_path); | 1812 | void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path); |
| 1848 | 1813 | ||
| 1849 | int reiserfs_insert_item (struct reiserfs_transaction_handle *th, | 1814 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, |
| 1850 | struct path * path, | 1815 | struct path *path, |
| 1851 | const struct cpu_key * key, | 1816 | const struct cpu_key *key, |
| 1852 | struct item_head * ih, | 1817 | struct item_head *ih, |
| 1853 | struct inode *inode, const char * body); | 1818 | struct inode *inode, const char *body); |
| 1854 | 1819 | ||
| 1855 | int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, | 1820 | int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, |
| 1856 | struct path * path, | 1821 | struct path *path, |
| 1857 | const struct cpu_key * key, | 1822 | const struct cpu_key *key, |
| 1858 | struct inode *inode, | 1823 | struct inode *inode, |
| 1859 | const char * body, int paste_size); | 1824 | const char *body, int paste_size); |
| 1860 | 1825 | ||
| 1861 | int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th, | 1826 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, |
| 1862 | struct path * path, | 1827 | struct path *path, |
| 1863 | struct cpu_key * key, | 1828 | struct cpu_key *key, |
| 1864 | struct inode * inode, | 1829 | struct inode *inode, |
| 1865 | struct page *page, | 1830 | struct page *page, loff_t new_file_size); |
| 1866 | loff_t new_file_size); | 1831 | |
| 1867 | 1832 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | |
| 1868 | int reiserfs_delete_item (struct reiserfs_transaction_handle *th, | 1833 | struct path *path, |
| 1869 | struct path * path, | 1834 | const struct cpu_key *key, |
| 1870 | const struct cpu_key * key, | 1835 | struct inode *inode, struct buffer_head *p_s_un_bh); |
| 1871 | struct inode * inode, | 1836 | |
| 1872 | struct buffer_head * p_s_un_bh); | 1837 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, |
| 1873 | 1838 | struct inode *inode, struct reiserfs_key *key); | |
| 1874 | void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th, | 1839 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, |
| 1875 | struct inode *inode, struct reiserfs_key * key); | 1840 | struct inode *p_s_inode); |
| 1876 | int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode); | 1841 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, |
| 1877 | int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, | 1842 | struct inode *p_s_inode, struct page *, |
| 1878 | struct inode * p_s_inode, struct page *, | 1843 | int update_timestamps); |
| 1879 | int update_timestamps); | ||
| 1880 | 1844 | ||
| 1881 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | 1845 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) |
| 1882 | #define file_size(inode) ((inode)->i_size) | 1846 | #define file_size(inode) ((inode)->i_size) |
| @@ -1885,66 +1849,67 @@ int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, | |||
| 1885 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ | 1849 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ |
| 1886 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) | 1850 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) |
| 1887 | 1851 | ||
| 1888 | void padd_item (char * item, int total_length, int length); | 1852 | void padd_item(char *item, int total_length, int length); |
| 1889 | 1853 | ||
| 1890 | /* inode.c */ | 1854 | /* inode.c */ |
| 1891 | /* args for the create parameter of reiserfs_get_block */ | 1855 | /* args for the create parameter of reiserfs_get_block */ |
| 1892 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ | 1856 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ |
| 1893 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | 1857 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ |
| 1894 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | 1858 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ |
| 1895 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | 1859 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ |
| 1896 | #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ | 1860 | #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ |
| 1897 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | 1861 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ |
| 1898 | 1862 | ||
| 1899 | int restart_transaction(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *path); | 1863 | int restart_transaction(struct reiserfs_transaction_handle *th, |
| 1900 | void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args *args) ; | 1864 | struct inode *inode, struct path *path); |
| 1901 | int reiserfs_find_actor(struct inode * inode, void *p) ; | 1865 | void reiserfs_read_locked_inode(struct inode *inode, |
| 1902 | int reiserfs_init_locked_inode(struct inode * inode, void *p) ; | 1866 | struct reiserfs_iget_args *args); |
| 1903 | void reiserfs_delete_inode (struct inode * inode); | 1867 | int reiserfs_find_actor(struct inode *inode, void *p); |
| 1904 | int reiserfs_write_inode (struct inode * inode, int) ; | 1868 | int reiserfs_init_locked_inode(struct inode *inode, void *p); |
| 1905 | int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create); | 1869 | void reiserfs_delete_inode(struct inode *inode); |
| 1906 | struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; | 1870 | int reiserfs_write_inode(struct inode *inode, int); |
| 1907 | struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, | 1871 | int reiserfs_get_block(struct inode *inode, sector_t block, |
| 1908 | int len, int fhtype, | 1872 | struct buffer_head *bh_result, int create); |
| 1909 | int (*acceptable)(void *contect, struct dentry *de), | 1873 | struct dentry *reiserfs_get_dentry(struct super_block *, void *); |
| 1910 | void *context) ; | 1874 | struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data, |
| 1911 | int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp, | 1875 | int len, int fhtype, |
| 1912 | int connectable ); | 1876 | int (*acceptable) (void *contect, |
| 1913 | 1877 | struct dentry * de), | |
| 1914 | int reiserfs_truncate_file(struct inode *, int update_timestamps) ; | 1878 | void *context); |
| 1915 | void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset, | 1879 | int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, |
| 1916 | int type, int key_length); | 1880 | int connectable); |
| 1917 | void make_le_item_head (struct item_head * ih, const struct cpu_key * key, | 1881 | |
| 1918 | int version, | 1882 | int reiserfs_truncate_file(struct inode *, int update_timestamps); |
| 1919 | loff_t offset, int type, int length, int entry_count); | 1883 | void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset, |
| 1920 | struct inode * reiserfs_iget (struct super_block * s, | 1884 | int type, int key_length); |
| 1921 | const struct cpu_key * key); | 1885 | void make_le_item_head(struct item_head *ih, const struct cpu_key *key, |
| 1922 | 1886 | int version, | |
| 1923 | 1887 | loff_t offset, int type, int length, int entry_count); | |
| 1924 | int reiserfs_new_inode (struct reiserfs_transaction_handle *th, | 1888 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); |
| 1925 | struct inode * dir, int mode, | 1889 | |
| 1926 | const char * symname, loff_t i_size, | 1890 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
| 1927 | struct dentry *dentry, struct inode *inode); | 1891 | struct inode *dir, int mode, |
| 1928 | 1892 | const char *symname, loff_t i_size, | |
| 1929 | void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th, | 1893 | struct dentry *dentry, struct inode *inode); |
| 1930 | struct inode * inode, loff_t size); | 1894 | |
| 1895 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | ||
| 1896 | struct inode *inode, loff_t size); | ||
| 1931 | 1897 | ||
| 1932 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, | 1898 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, |
| 1933 | struct inode *inode) | 1899 | struct inode *inode) |
| 1934 | { | 1900 | { |
| 1935 | reiserfs_update_sd_size(th, inode, inode->i_size) ; | 1901 | reiserfs_update_sd_size(th, inode, inode->i_size); |
| 1936 | } | 1902 | } |
| 1937 | 1903 | ||
| 1938 | void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode ); | 1904 | void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); |
| 1939 | void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs ); | 1905 | void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); |
| 1940 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); | 1906 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); |
| 1941 | 1907 | ||
| 1942 | /* namei.c */ | 1908 | /* namei.c */ |
| 1943 | void set_de_name_and_namelen (struct reiserfs_dir_entry * de); | 1909 | void set_de_name_and_namelen(struct reiserfs_dir_entry *de); |
| 1944 | int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, | 1910 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, |
| 1945 | struct path * path, | 1911 | struct path *path, struct reiserfs_dir_entry *de); |
| 1946 | struct reiserfs_dir_entry * de); | 1912 | struct dentry *reiserfs_get_parent(struct dentry *); |
| 1947 | struct dentry *reiserfs_get_parent(struct dentry *) ; | ||
| 1948 | /* procfs.c */ | 1913 | /* procfs.c */ |
| 1949 | 1914 | ||
| 1950 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | 1915 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) |
| @@ -1953,15 +1918,15 @@ struct dentry *reiserfs_get_parent(struct dentry *) ; | |||
| 1953 | #undef REISERFS_PROC_INFO | 1918 | #undef REISERFS_PROC_INFO |
| 1954 | #endif | 1919 | #endif |
| 1955 | 1920 | ||
| 1956 | int reiserfs_proc_info_init( struct super_block *sb ); | 1921 | int reiserfs_proc_info_init(struct super_block *sb); |
| 1957 | int reiserfs_proc_info_done( struct super_block *sb ); | 1922 | int reiserfs_proc_info_done(struct super_block *sb); |
| 1958 | struct proc_dir_entry *reiserfs_proc_register_global( char *name, | 1923 | struct proc_dir_entry *reiserfs_proc_register_global(char *name, |
| 1959 | read_proc_t *func ); | 1924 | read_proc_t * func); |
| 1960 | void reiserfs_proc_unregister_global( const char *name ); | 1925 | void reiserfs_proc_unregister_global(const char *name); |
| 1961 | int reiserfs_proc_info_global_init( void ); | 1926 | int reiserfs_proc_info_global_init(void); |
| 1962 | int reiserfs_proc_info_global_done( void ); | 1927 | int reiserfs_proc_info_global_done(void); |
| 1963 | int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, | 1928 | int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, |
| 1964 | int count, int *eof, void *data ); | 1929 | int count, int *eof, void *data); |
| 1965 | 1930 | ||
| 1966 | #if defined( REISERFS_PROC_INFO ) | 1931 | #if defined( REISERFS_PROC_INFO ) |
| 1967 | 1932 | ||
| @@ -1993,123 +1958,132 @@ extern struct inode_operations reiserfs_special_inode_operations; | |||
| 1993 | extern struct file_operations reiserfs_dir_operations; | 1958 | extern struct file_operations reiserfs_dir_operations; |
| 1994 | 1959 | ||
| 1995 | /* tail_conversion.c */ | 1960 | /* tail_conversion.c */ |
| 1996 | int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t); | 1961 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, |
| 1997 | int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *); | 1962 | struct path *, struct buffer_head *, loff_t); |
| 1998 | void reiserfs_unmap_buffer(struct buffer_head *) ; | 1963 | int indirect2direct(struct reiserfs_transaction_handle *, struct inode *, |
| 1999 | 1964 | struct page *, struct path *, const struct cpu_key *, | |
| 1965 | loff_t, char *); | ||
| 1966 | void reiserfs_unmap_buffer(struct buffer_head *); | ||
| 2000 | 1967 | ||
| 2001 | /* file.c */ | 1968 | /* file.c */ |
| 2002 | extern struct inode_operations reiserfs_file_inode_operations; | 1969 | extern struct inode_operations reiserfs_file_inode_operations; |
| 2003 | extern struct file_operations reiserfs_file_operations; | 1970 | extern struct file_operations reiserfs_file_operations; |
| 2004 | extern struct address_space_operations reiserfs_address_space_operations ; | 1971 | extern struct address_space_operations reiserfs_address_space_operations; |
| 2005 | 1972 | ||
| 2006 | /* fix_nodes.c */ | 1973 | /* fix_nodes.c */ |
| 2007 | #ifdef CONFIG_REISERFS_CHECK | 1974 | #ifdef CONFIG_REISERFS_CHECK |
| 2008 | void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); | 1975 | void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s); |
| 2009 | void reiserfs_kfree (const void * vp, size_t size, struct super_block * s); | 1976 | void reiserfs_kfree(const void *vp, size_t size, struct super_block *s); |
| 2010 | #else | 1977 | #else |
| 2011 | static inline void *reiserfs_kmalloc(size_t size, int flags, | 1978 | static inline void *reiserfs_kmalloc(size_t size, int flags, |
| 2012 | struct super_block *s) | 1979 | struct super_block *s) |
| 2013 | { | 1980 | { |
| 2014 | return kmalloc(size, flags); | 1981 | return kmalloc(size, flags); |
| 2015 | } | 1982 | } |
| 2016 | 1983 | ||
| 2017 | static inline void reiserfs_kfree(const void *vp, size_t size, | 1984 | static inline void reiserfs_kfree(const void *vp, size_t size, |
| 2018 | struct super_block *s) | 1985 | struct super_block *s) |
| 2019 | { | 1986 | { |
| 2020 | kfree(vp); | 1987 | kfree(vp); |
| 2021 | } | 1988 | } |
| 2022 | #endif | 1989 | #endif |
| 2023 | 1990 | ||
| 2024 | int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, | 1991 | int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, |
| 2025 | struct item_head * p_s_ins_ih, const void *); | 1992 | struct item_head *p_s_ins_ih, const void *); |
| 2026 | void unfix_nodes (struct tree_balance *); | 1993 | void unfix_nodes(struct tree_balance *); |
| 2027 | |||
| 2028 | 1994 | ||
| 2029 | /* prints.c */ | 1995 | /* prints.c */ |
| 2030 | void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) ); | 1996 | void reiserfs_panic(struct super_block *s, const char *fmt, ...) |
| 2031 | void reiserfs_info (struct super_block *s, const char * fmt, ...); | 1997 | __attribute__ ((noreturn)); |
| 2032 | void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...); | 1998 | void reiserfs_info(struct super_block *s, const char *fmt, ...); |
| 2033 | void print_indirect_item (struct buffer_head * bh, int item_num); | 1999 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); |
| 2034 | void store_print_tb (struct tree_balance * tb); | 2000 | void print_indirect_item(struct buffer_head *bh, int item_num); |
| 2035 | void print_cur_tb (char * mes); | 2001 | void store_print_tb(struct tree_balance *tb); |
| 2036 | void print_de (struct reiserfs_dir_entry * de); | 2002 | void print_cur_tb(char *mes); |
| 2037 | void print_bi (struct buffer_info * bi, char * mes); | 2003 | void print_de(struct reiserfs_dir_entry *de); |
| 2038 | #define PRINT_LEAF_ITEMS 1 /* print all items */ | 2004 | void print_bi(struct buffer_info *bi, char *mes); |
| 2039 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ | 2005 | #define PRINT_LEAF_ITEMS 1 /* print all items */ |
| 2040 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ | 2006 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ |
| 2041 | void print_block (struct buffer_head * bh, ...); | 2007 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ |
| 2042 | void print_bmap (struct super_block * s, int silent); | 2008 | void print_block(struct buffer_head *bh, ...); |
| 2043 | void print_bmap_block (int i, char * data, int size, int silent); | 2009 | void print_bmap(struct super_block *s, int silent); |
| 2010 | void print_bmap_block(int i, char *data, int size, int silent); | ||
| 2044 | /*void print_super_block (struct super_block * s, char * mes);*/ | 2011 | /*void print_super_block (struct super_block * s, char * mes);*/ |
| 2045 | void print_objectid_map (struct super_block * s); | 2012 | void print_objectid_map(struct super_block *s); |
| 2046 | void print_block_head (struct buffer_head * bh, char * mes); | 2013 | void print_block_head(struct buffer_head *bh, char *mes); |
| 2047 | void check_leaf (struct buffer_head * bh); | 2014 | void check_leaf(struct buffer_head *bh); |
| 2048 | void check_internal (struct buffer_head * bh); | 2015 | void check_internal(struct buffer_head *bh); |
| 2049 | void print_statistics (struct super_block * s); | 2016 | void print_statistics(struct super_block *s); |
| 2050 | char * reiserfs_hashname(int code); | 2017 | char *reiserfs_hashname(int code); |
| 2051 | 2018 | ||
| 2052 | /* lbalance.c */ | 2019 | /* lbalance.c */ |
| 2053 | int leaf_move_items (int shift_mode, struct tree_balance * tb, int mov_num, int mov_bytes, struct buffer_head * Snew); | 2020 | int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, |
| 2054 | int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes); | 2021 | int mov_bytes, struct buffer_head *Snew); |
| 2055 | int leaf_shift_right (struct tree_balance * tb, int shift_num, int shift_bytes); | 2022 | int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes); |
| 2056 | void leaf_delete_items (struct buffer_info * cur_bi, int last_first, int first, int del_num, int del_bytes); | 2023 | int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes); |
| 2057 | void leaf_insert_into_buf (struct buffer_info * bi, int before, | 2024 | void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, |
| 2058 | struct item_head * inserted_item_ih, const char * inserted_item_body, int zeros_number); | 2025 | int del_num, int del_bytes); |
| 2059 | void leaf_paste_in_buffer (struct buffer_info * bi, int pasted_item_num, | 2026 | void leaf_insert_into_buf(struct buffer_info *bi, int before, |
| 2060 | int pos_in_item, int paste_size, const char * body, int zeros_number); | 2027 | struct item_head *inserted_item_ih, |
| 2061 | void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num, int pos_in_item, | 2028 | const char *inserted_item_body, int zeros_number); |
| 2062 | int cut_size); | 2029 | void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, |
| 2063 | void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, | 2030 | int pos_in_item, int paste_size, const char *body, |
| 2064 | int new_entry_count, struct reiserfs_de_head * new_dehs, const char * records, int paste_size); | 2031 | int zeros_number); |
| 2032 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | ||
| 2033 | int pos_in_item, int cut_size); | ||
| 2034 | void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, | ||
| 2035 | int new_entry_count, struct reiserfs_de_head *new_dehs, | ||
| 2036 | const char *records, int paste_size); | ||
| 2065 | /* ibalance.c */ | 2037 | /* ibalance.c */ |
| 2066 | int balance_internal (struct tree_balance * , int, int, struct item_head * , | 2038 | int balance_internal(struct tree_balance *, int, int, struct item_head *, |
| 2067 | struct buffer_head **); | 2039 | struct buffer_head **); |
| 2068 | 2040 | ||
| 2069 | /* do_balance.c */ | 2041 | /* do_balance.c */ |
| 2070 | void do_balance_mark_leaf_dirty (struct tree_balance * tb, | 2042 | void do_balance_mark_leaf_dirty(struct tree_balance *tb, |
| 2071 | struct buffer_head * bh, int flag); | 2043 | struct buffer_head *bh, int flag); |
| 2072 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty | 2044 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty |
| 2073 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty | 2045 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty |
| 2074 | 2046 | ||
| 2075 | void do_balance (struct tree_balance * tb, struct item_head * ih, | 2047 | void do_balance(struct tree_balance *tb, struct item_head *ih, |
| 2076 | const char * body, int flag); | 2048 | const char *body, int flag); |
| 2077 | void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh); | 2049 | void reiserfs_invalidate_buffer(struct tree_balance *tb, |
| 2050 | struct buffer_head *bh); | ||
| 2078 | 2051 | ||
| 2079 | int get_left_neighbor_position (struct tree_balance * tb, int h); | 2052 | int get_left_neighbor_position(struct tree_balance *tb, int h); |
| 2080 | int get_right_neighbor_position (struct tree_balance * tb, int h); | 2053 | int get_right_neighbor_position(struct tree_balance *tb, int h); |
| 2081 | void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int); | 2054 | void replace_key(struct tree_balance *tb, struct buffer_head *, int, |
| 2082 | void make_empty_node (struct buffer_info *); | 2055 | struct buffer_head *, int); |
| 2083 | struct buffer_head * get_FEB (struct tree_balance *); | 2056 | void make_empty_node(struct buffer_info *); |
| 2057 | struct buffer_head *get_FEB(struct tree_balance *); | ||
| 2084 | 2058 | ||
| 2085 | /* bitmap.c */ | 2059 | /* bitmap.c */ |
| 2086 | 2060 | ||
| 2087 | /* structure contains hints for block allocator, and it is a container for | 2061 | /* structure contains hints for block allocator, and it is a container for |
| 2088 | * arguments, such as node, search path, transaction_handle, etc. */ | 2062 | * arguments, such as node, search path, transaction_handle, etc. */ |
| 2089 | struct __reiserfs_blocknr_hint { | 2063 | struct __reiserfs_blocknr_hint { |
| 2090 | struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */ | 2064 | struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ |
| 2091 | long block; /* file offset, in blocks */ | 2065 | long block; /* file offset, in blocks */ |
| 2092 | struct in_core_key key; | 2066 | struct in_core_key key; |
| 2093 | struct path * path; /* search path, used by allocator to deternine search_start by | 2067 | struct path *path; /* search path, used by allocator to deternine search_start by |
| 2094 | * various ways */ | 2068 | * various ways */ |
| 2095 | struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and | 2069 | struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and |
| 2096 | * bitmap blocks changes */ | 2070 | * bitmap blocks changes */ |
| 2097 | b_blocknr_t beg, end; | 2071 | b_blocknr_t beg, end; |
| 2098 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) | 2072 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) |
| 2099 | * between different block allocator procedures | 2073 | * between different block allocator procedures |
| 2100 | * (determine_search_start() and others) */ | 2074 | * (determine_search_start() and others) */ |
| 2101 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed | 2075 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed |
| 2102 | * function that do actual allocation */ | 2076 | * function that do actual allocation */ |
| 2103 | 2077 | ||
| 2104 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for | 2078 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for |
| 2105 | * formatted/unformatted blocks with/without preallocation */ | 2079 | * formatted/unformatted blocks with/without preallocation */ |
| 2106 | unsigned preallocate:1; | 2080 | unsigned preallocate:1; |
| 2107 | }; | 2081 | }; |
| 2108 | 2082 | ||
| 2109 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; | 2083 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; |
| 2110 | 2084 | ||
| 2111 | int reiserfs_parse_alloc_options (struct super_block *, char *); | 2085 | int reiserfs_parse_alloc_options(struct super_block *, char *); |
| 2112 | void reiserfs_init_alloc_options (struct super_block *s); | 2086 | void reiserfs_init_alloc_options(struct super_block *s); |
| 2113 | 2087 | ||
| 2114 | /* | 2088 | /* |
| 2115 | * given a directory, this will tell you what packing locality | 2089 | * given a directory, this will tell you what packing locality |
| @@ -2118,68 +2092,72 @@ void reiserfs_init_alloc_options (struct super_block *s); | |||
| 2118 | */ | 2092 | */ |
| 2119 | __le32 reiserfs_choose_packing(struct inode *dir); | 2093 | __le32 reiserfs_choose_packing(struct inode *dir); |
| 2120 | 2094 | ||
| 2121 | int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value); | 2095 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); |
| 2122 | void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); | 2096 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, |
| 2123 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t * , int, int); | 2097 | b_blocknr_t, int for_unformatted); |
| 2124 | extern inline int reiserfs_new_form_blocknrs (struct tree_balance * tb, | 2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, |
| 2125 | b_blocknr_t *new_blocknrs, int amount_needed) | 2099 | int); |
| 2100 | extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | ||
| 2101 | b_blocknr_t * new_blocknrs, | ||
| 2102 | int amount_needed) | ||
| 2126 | { | 2103 | { |
| 2127 | reiserfs_blocknr_hint_t hint = { | 2104 | reiserfs_blocknr_hint_t hint = { |
| 2128 | .th = tb->transaction_handle, | 2105 | .th = tb->transaction_handle, |
| 2129 | .path = tb->tb_path, | 2106 | .path = tb->tb_path, |
| 2130 | .inode = NULL, | 2107 | .inode = NULL, |
| 2131 | .key = tb->key, | 2108 | .key = tb->key, |
| 2132 | .block = 0, | 2109 | .block = 0, |
| 2133 | .formatted_node = 1 | 2110 | .formatted_node = 1 |
| 2134 | }; | 2111 | }; |
| 2135 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, 0); | 2112 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, |
| 2113 | 0); | ||
| 2136 | } | 2114 | } |
| 2137 | 2115 | ||
| 2138 | extern inline int reiserfs_new_unf_blocknrs (struct reiserfs_transaction_handle *th, | 2116 | extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle |
| 2139 | struct inode *inode, | 2117 | *th, struct inode *inode, |
| 2140 | b_blocknr_t *new_blocknrs, | 2118 | b_blocknr_t * new_blocknrs, |
| 2141 | struct path * path, long block) | 2119 | struct path *path, long block) |
| 2142 | { | 2120 | { |
| 2143 | reiserfs_blocknr_hint_t hint = { | 2121 | reiserfs_blocknr_hint_t hint = { |
| 2144 | .th = th, | 2122 | .th = th, |
| 2145 | .path = path, | 2123 | .path = path, |
| 2146 | .inode = inode, | 2124 | .inode = inode, |
| 2147 | .block = block, | 2125 | .block = block, |
| 2148 | .formatted_node = 0, | 2126 | .formatted_node = 0, |
| 2149 | .preallocate = 0 | 2127 | .preallocate = 0 |
| 2150 | }; | 2128 | }; |
| 2151 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | 2129 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); |
| 2152 | } | 2130 | } |
| 2153 | 2131 | ||
| 2154 | #ifdef REISERFS_PREALLOCATE | 2132 | #ifdef REISERFS_PREALLOCATE |
| 2155 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle *th, | 2133 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle |
| 2156 | struct inode * inode, | 2134 | *th, struct inode *inode, |
| 2157 | b_blocknr_t *new_blocknrs, | 2135 | b_blocknr_t * new_blocknrs, |
| 2158 | struct path * path, long block) | 2136 | struct path *path, long block) |
| 2159 | { | 2137 | { |
| 2160 | reiserfs_blocknr_hint_t hint = { | 2138 | reiserfs_blocknr_hint_t hint = { |
| 2161 | .th = th, | 2139 | .th = th, |
| 2162 | .path = path, | 2140 | .path = path, |
| 2163 | .inode = inode, | 2141 | .inode = inode, |
| 2164 | .block = block, | 2142 | .block = block, |
| 2165 | .formatted_node = 0, | 2143 | .formatted_node = 0, |
| 2166 | .preallocate = 1 | 2144 | .preallocate = 1 |
| 2167 | }; | 2145 | }; |
| 2168 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | 2146 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); |
| 2169 | } | 2147 | } |
| 2170 | 2148 | ||
| 2171 | void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, | 2149 | void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, |
| 2172 | struct inode * inode); | 2150 | struct inode *inode); |
| 2173 | void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th); | 2151 | void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); |
| 2174 | #endif | 2152 | #endif |
| 2175 | void reiserfs_claim_blocks_to_be_allocated( struct super_block *sb, int blocks); | 2153 | void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks); |
| 2176 | void reiserfs_release_claimed_blocks( struct super_block *sb, int blocks); | 2154 | void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks); |
| 2177 | int reiserfs_can_fit_pages(struct super_block *sb); | 2155 | int reiserfs_can_fit_pages(struct super_block *sb); |
| 2178 | 2156 | ||
| 2179 | /* hashes.c */ | 2157 | /* hashes.c */ |
| 2180 | __u32 keyed_hash (const signed char *msg, int len); | 2158 | __u32 keyed_hash(const signed char *msg, int len); |
| 2181 | __u32 yura_hash (const signed char *msg, int len); | 2159 | __u32 yura_hash(const signed char *msg, int len); |
| 2182 | __u32 r5_hash (const signed char *msg, int len); | 2160 | __u32 r5_hash(const signed char *msg, int len); |
| 2183 | 2161 | ||
| 2184 | /* the ext2 bit routines adjust for big or little endian as | 2162 | /* the ext2 bit routines adjust for big or little endian as |
| 2185 | ** appropriate for the arch, so in our laziness we use them rather | 2163 | ** appropriate for the arch, so in our laziness we use them rather |
| @@ -2199,11 +2177,10 @@ __u32 r5_hash (const signed char *msg, int len); | |||
| 2199 | absolutely safe */ | 2177 | absolutely safe */ |
| 2200 | #define SPARE_SPACE 500 | 2178 | #define SPARE_SPACE 500 |
| 2201 | 2179 | ||
| 2202 | |||
| 2203 | /* prototypes from ioctl.c */ | 2180 | /* prototypes from ioctl.c */ |
| 2204 | int reiserfs_ioctl (struct inode * inode, struct file * filp, | 2181 | int reiserfs_ioctl(struct inode *inode, struct file *filp, |
| 2205 | unsigned int cmd, unsigned long arg); | 2182 | unsigned int cmd, unsigned long arg); |
| 2206 | 2183 | ||
| 2207 | /* ioctl's command */ | 2184 | /* ioctl's command */ |
| 2208 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | 2185 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) |
| 2209 | /* define following flags to be the same as in ext2, so that chattr(1), | 2186 | /* define following flags to be the same as in ext2, so that chattr(1), |
| @@ -2218,10 +2195,8 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, | |||
| 2218 | would evolve into real per-fs locks */ | 2195 | would evolve into real per-fs locks */ |
| 2219 | #define reiserfs_write_lock( sb ) lock_kernel() | 2196 | #define reiserfs_write_lock( sb ) lock_kernel() |
| 2220 | #define reiserfs_write_unlock( sb ) unlock_kernel() | 2197 | #define reiserfs_write_unlock( sb ) unlock_kernel() |
| 2221 | 2198 | ||
| 2222 | /* xattr stuff */ | 2199 | /* xattr stuff */ |
| 2223 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | 2200 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) |
| 2224 | 2201 | ||
| 2225 | #endif /* _LINUX_REISER_FS_H */ | 2202 | #endif /* _LINUX_REISER_FS_H */ |
| 2226 | |||
| 2227 | |||
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index e321eb050d65..149be8d9a0c9 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h | |||
| @@ -10,54 +10,53 @@ typedef enum { | |||
| 10 | /** this says what format of key do all items (but stat data) of | 10 | /** this says what format of key do all items (but stat data) of |
| 11 | an object have. If this is set, that format is 3.6 otherwise | 11 | an object have. If this is set, that format is 3.6 otherwise |
| 12 | - 3.5 */ | 12 | - 3.5 */ |
| 13 | i_item_key_version_mask = 0x0001, | 13 | i_item_key_version_mask = 0x0001, |
| 14 | /** If this is unset, object has 3.5 stat data, otherwise, it has | 14 | /** If this is unset, object has 3.5 stat data, otherwise, it has |
| 15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ | 15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ |
| 16 | i_stat_data_version_mask = 0x0002, | 16 | i_stat_data_version_mask = 0x0002, |
| 17 | /** file might need tail packing on close */ | 17 | /** file might need tail packing on close */ |
| 18 | i_pack_on_close_mask = 0x0004, | 18 | i_pack_on_close_mask = 0x0004, |
| 19 | /** don't pack tail of file */ | 19 | /** don't pack tail of file */ |
| 20 | i_nopack_mask = 0x0008, | 20 | i_nopack_mask = 0x0008, |
| 21 | /** If those is set, "safe link" was created for this file during | 21 | /** If those is set, "safe link" was created for this file during |
| 22 | truncate or unlink. Safe link is used to avoid leakage of disk | 22 | truncate or unlink. Safe link is used to avoid leakage of disk |
| 23 | space on crash with some files open, but unlinked. */ | 23 | space on crash with some files open, but unlinked. */ |
| 24 | i_link_saved_unlink_mask = 0x0010, | 24 | i_link_saved_unlink_mask = 0x0010, |
| 25 | i_link_saved_truncate_mask = 0x0020, | 25 | i_link_saved_truncate_mask = 0x0020, |
| 26 | i_has_xattr_dir = 0x0040, | 26 | i_has_xattr_dir = 0x0040, |
| 27 | i_data_log = 0x0080, | 27 | i_data_log = 0x0080, |
| 28 | } reiserfs_inode_flags; | 28 | } reiserfs_inode_flags; |
| 29 | 29 | ||
| 30 | |||
| 31 | struct reiserfs_inode_info { | 30 | struct reiserfs_inode_info { |
| 32 | __u32 i_key [4];/* key is still 4 32 bit integers */ | 31 | __u32 i_key[4]; /* key is still 4 32 bit integers */ |
| 33 | /** transient inode flags that are never stored on disk. Bitmasks | 32 | /** transient inode flags that are never stored on disk. Bitmasks |
| 34 | for this field are defined above. */ | 33 | for this field are defined above. */ |
| 35 | __u32 i_flags; | 34 | __u32 i_flags; |
| 36 | 35 | ||
| 37 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. | 36 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. |
| 38 | 37 | ||
| 39 | /* copy of persistent inode flags read from sd_attrs. */ | 38 | /* copy of persistent inode flags read from sd_attrs. */ |
| 40 | __u32 i_attrs; | 39 | __u32 i_attrs; |
| 41 | 40 | ||
| 42 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ | 41 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ |
| 43 | int i_prealloc_count; /* length of that sequence */ | 42 | int i_prealloc_count; /* length of that sequence */ |
| 44 | struct list_head i_prealloc_list; /* per-transaction list of inodes which | 43 | struct list_head i_prealloc_list; /* per-transaction list of inodes which |
| 45 | * have preallocated blocks */ | 44 | * have preallocated blocks */ |
| 46 | 45 | ||
| 47 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks | 46 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks |
| 48 | * for the contents of this directory should be | 47 | * for the contents of this directory should be |
| 49 | * displaced */ | 48 | * displaced */ |
| 50 | 49 | ||
| 51 | /* we use these for fsync or O_SYNC to decide which transaction | 50 | /* we use these for fsync or O_SYNC to decide which transaction |
| 52 | ** needs to be committed in order for this inode to be properly | 51 | ** needs to be committed in order for this inode to be properly |
| 53 | ** flushed */ | 52 | ** flushed */ |
| 54 | unsigned long i_trans_id ; | 53 | unsigned long i_trans_id; |
| 55 | struct reiserfs_journal_list *i_jl; | 54 | struct reiserfs_journal_list *i_jl; |
| 56 | 55 | ||
| 57 | struct posix_acl *i_acl_access; | 56 | struct posix_acl *i_acl_access; |
| 58 | struct posix_acl *i_acl_default; | 57 | struct posix_acl *i_acl_default; |
| 59 | struct rw_semaphore xattr_sem; | 58 | struct rw_semaphore xattr_sem; |
| 60 | struct inode vfs_inode; | 59 | struct inode vfs_inode; |
| 61 | }; | 60 | }; |
| 62 | 61 | ||
| 63 | #endif | 62 | #endif |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 31c709d0fe18..3e68592e52e9 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #endif | 10 | #endif |
| 11 | 11 | ||
| 12 | typedef enum { | 12 | typedef enum { |
| 13 | reiserfs_attrs_cleared = 0x00000001, | 13 | reiserfs_attrs_cleared = 0x00000001, |
| 14 | } reiserfs_super_block_flags; | 14 | } reiserfs_super_block_flags; |
| 15 | 15 | ||
| 16 | /* struct reiserfs_super_block accessors/mutators | 16 | /* struct reiserfs_super_block accessors/mutators |
| @@ -61,7 +61,7 @@ typedef enum { | |||
| 61 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) | 61 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) |
| 62 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) | 62 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) |
| 63 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) | 63 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) |
| 64 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) | 64 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) |
| 65 | #define sb_hash_function_code(sbp) \ | 65 | #define sb_hash_function_code(sbp) \ |
| 66 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) | 66 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) |
| 67 | #define set_sb_hash_function_code(sbp,v) \ | 67 | #define set_sb_hash_function_code(sbp,v) \ |
| @@ -103,10 +103,10 @@ typedef enum { | |||
| 103 | 103 | ||
| 104 | /* don't mess with these for a while */ | 104 | /* don't mess with these for a while */ |
| 105 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ | 105 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ |
| 106 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ | 106 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ |
| 107 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ | 107 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ |
| 108 | #define JOURNAL_HASH_SIZE 8192 | 108 | #define JOURNAL_HASH_SIZE 8192 |
| 109 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ | 109 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ |
| 110 | 110 | ||
| 111 | /* One of these for every block in every transaction | 111 | /* One of these for every block in every transaction |
| 112 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a | 112 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a |
| @@ -117,27 +117,27 @@ typedef enum { | |||
| 117 | ** to a given transaction. | 117 | ** to a given transaction. |
| 118 | */ | 118 | */ |
| 119 | struct reiserfs_journal_cnode { | 119 | struct reiserfs_journal_cnode { |
| 120 | struct buffer_head *bh ; /* real buffer head */ | 120 | struct buffer_head *bh; /* real buffer head */ |
| 121 | struct super_block *sb ; /* dev of real buffer head */ | 121 | struct super_block *sb; /* dev of real buffer head */ |
| 122 | __u32 blocknr ; /* block number of real buffer head, == 0 when buffer on disk */ | 122 | __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ |
| 123 | long state ; | 123 | long state; |
| 124 | struct reiserfs_journal_list *jlist ; /* journal list this cnode lives in */ | 124 | struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ |
| 125 | struct reiserfs_journal_cnode *next ; /* next in transaction list */ | 125 | struct reiserfs_journal_cnode *next; /* next in transaction list */ |
| 126 | struct reiserfs_journal_cnode *prev ; /* prev in transaction list */ | 126 | struct reiserfs_journal_cnode *prev; /* prev in transaction list */ |
| 127 | struct reiserfs_journal_cnode *hprev ; /* prev in hash list */ | 127 | struct reiserfs_journal_cnode *hprev; /* prev in hash list */ |
| 128 | struct reiserfs_journal_cnode *hnext ; /* next in hash list */ | 128 | struct reiserfs_journal_cnode *hnext; /* next in hash list */ |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | struct reiserfs_bitmap_node { | 131 | struct reiserfs_bitmap_node { |
| 132 | int id ; | 132 | int id; |
| 133 | char *data ; | 133 | char *data; |
| 134 | struct list_head list ; | 134 | struct list_head list; |
| 135 | } ; | 135 | }; |
| 136 | 136 | ||
| 137 | struct reiserfs_list_bitmap { | 137 | struct reiserfs_list_bitmap { |
| 138 | struct reiserfs_journal_list *journal_list ; | 138 | struct reiserfs_journal_list *journal_list; |
| 139 | struct reiserfs_bitmap_node **bitmaps ; | 139 | struct reiserfs_bitmap_node **bitmaps; |
| 140 | } ; | 140 | }; |
| 141 | 141 | ||
| 142 | /* | 142 | /* |
| 143 | ** one of these for each transaction. The most important part here is the j_realblock. | 143 | ** one of these for each transaction. The most important part here is the j_realblock. |
| @@ -146,273 +146,269 @@ struct reiserfs_list_bitmap { | |||
| 146 | ** and to make sure every real block in a transaction is on disk before allowing the log area | 146 | ** and to make sure every real block in a transaction is on disk before allowing the log area |
| 147 | ** to be overwritten */ | 147 | ** to be overwritten */ |
| 148 | struct reiserfs_journal_list { | 148 | struct reiserfs_journal_list { |
| 149 | unsigned long j_start ; | 149 | unsigned long j_start; |
| 150 | unsigned long j_state; | 150 | unsigned long j_state; |
| 151 | unsigned long j_len ; | 151 | unsigned long j_len; |
| 152 | atomic_t j_nonzerolen ; | 152 | atomic_t j_nonzerolen; |
| 153 | atomic_t j_commit_left ; | 153 | atomic_t j_commit_left; |
| 154 | atomic_t j_older_commits_done ; /* all commits older than this on disk*/ | 154 | atomic_t j_older_commits_done; /* all commits older than this on disk */ |
| 155 | struct semaphore j_commit_lock; | 155 | struct semaphore j_commit_lock; |
| 156 | unsigned long j_trans_id ; | 156 | unsigned long j_trans_id; |
| 157 | time_t j_timestamp ; | 157 | time_t j_timestamp; |
| 158 | struct reiserfs_list_bitmap *j_list_bitmap ; | 158 | struct reiserfs_list_bitmap *j_list_bitmap; |
| 159 | struct buffer_head *j_commit_bh ; /* commit buffer head */ | 159 | struct buffer_head *j_commit_bh; /* commit buffer head */ |
| 160 | struct reiserfs_journal_cnode *j_realblock ; | 160 | struct reiserfs_journal_cnode *j_realblock; |
| 161 | struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ | 161 | struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */ |
| 162 | /* time ordered list of all active transactions */ | 162 | /* time ordered list of all active transactions */ |
| 163 | struct list_head j_list; | 163 | struct list_head j_list; |
| 164 | 164 | ||
| 165 | /* time ordered list of all transactions we haven't tried to flush yet */ | 165 | /* time ordered list of all transactions we haven't tried to flush yet */ |
| 166 | struct list_head j_working_list; | 166 | struct list_head j_working_list; |
| 167 | 167 | ||
| 168 | /* list of tail conversion targets in need of flush before commit */ | 168 | /* list of tail conversion targets in need of flush before commit */ |
| 169 | struct list_head j_tail_bh_list; | 169 | struct list_head j_tail_bh_list; |
| 170 | /* list of data=ordered buffers in need of flush before commit */ | 170 | /* list of data=ordered buffers in need of flush before commit */ |
| 171 | struct list_head j_bh_list; | 171 | struct list_head j_bh_list; |
| 172 | int j_refcount; | 172 | int j_refcount; |
| 173 | } ; | 173 | }; |
| 174 | 174 | ||
| 175 | struct reiserfs_journal { | 175 | struct reiserfs_journal { |
| 176 | struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ | 176 | struct buffer_head **j_ap_blocks; /* journal blocks on disk */ |
| 177 | struct reiserfs_journal_cnode *j_last ; /* newest journal block */ | 177 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ |
| 178 | struct reiserfs_journal_cnode *j_first ; /* oldest journal block. start here for traverse */ | 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ |
| 179 | 179 | ||
| 180 | struct file *j_dev_file; | 180 | struct file *j_dev_file; |
| 181 | struct block_device *j_dev_bd; | 181 | struct block_device *j_dev_bd; |
| 182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
| 183 | 183 | ||
| 184 | long j_state ; | 184 | long j_state; |
| 185 | unsigned long j_trans_id ; | 185 | unsigned long j_trans_id; |
| 186 | unsigned long j_mount_id ; | 186 | unsigned long j_mount_id; |
| 187 | unsigned long j_start ; /* start of current waiting commit (index into j_ap_blocks) */ | 187 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ |
| 188 | unsigned long j_len ; /* lenght of current waiting commit */ | 188 | unsigned long j_len; /* lenght of current waiting commit */ |
| 189 | unsigned long j_len_alloc ; /* number of buffers requested by journal_begin() */ | 189 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ |
| 190 | atomic_t j_wcount ; /* count of writers for current commit */ | 190 | atomic_t j_wcount; /* count of writers for current commit */ |
| 191 | unsigned long j_bcount ; /* batch count. allows turning X transactions into 1 */ | 191 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ |
| 192 | unsigned long j_first_unflushed_offset ; /* first unflushed transactions offset */ | 192 | unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ |
| 193 | unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ | 193 | unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */ |
| 194 | struct buffer_head *j_header_bh ; | 194 | struct buffer_head *j_header_bh; |
| 195 | 195 | ||
| 196 | time_t j_trans_start_time ; /* time this transaction started */ | 196 | time_t j_trans_start_time; /* time this transaction started */ |
| 197 | struct semaphore j_lock; | 197 | struct semaphore j_lock; |
| 198 | struct semaphore j_flush_sem; | 198 | struct semaphore j_flush_sem; |
| 199 | wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ | 199 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ |
| 200 | atomic_t j_jlock ; /* lock for j_join_wait */ | 200 | atomic_t j_jlock; /* lock for j_join_wait */ |
| 201 | int j_list_bitmap_index ; /* number of next list bitmap to use */ | 201 | int j_list_bitmap_index; /* number of next list bitmap to use */ |
| 202 | int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ | 202 | int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */ |
| 203 | int j_next_full_flush ; /* next journal_end will flush all journal list */ | 203 | int j_next_full_flush; /* next journal_end will flush all journal list */ |
| 204 | int j_next_async_flush ; /* next journal_end will flush all async commits */ | 204 | int j_next_async_flush; /* next journal_end will flush all async commits */ |
| 205 | 205 | ||
| 206 | int j_cnode_used ; /* number of cnodes on the used list */ | 206 | int j_cnode_used; /* number of cnodes on the used list */ |
| 207 | int j_cnode_free ; /* number of cnodes on the free list */ | 207 | int j_cnode_free; /* number of cnodes on the free list */ |
| 208 | 208 | ||
| 209 | unsigned int j_trans_max ; /* max number of blocks in a transaction. */ | 209 | unsigned int j_trans_max; /* max number of blocks in a transaction. */ |
| 210 | unsigned int j_max_batch ; /* max number of blocks to batch into a trans */ | 210 | unsigned int j_max_batch; /* max number of blocks to batch into a trans */ |
| 211 | unsigned int j_max_commit_age ; /* in seconds, how old can an async commit be */ | 211 | unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */ |
| 212 | unsigned int j_max_trans_age ; /* in seconds, how old can a transaction be */ | 212 | unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */ |
| 213 | unsigned int j_default_max_commit_age ; /* the default for the max commit age */ | 213 | unsigned int j_default_max_commit_age; /* the default for the max commit age */ |
| 214 | 214 | ||
| 215 | struct reiserfs_journal_cnode *j_cnode_free_list ; | 215 | struct reiserfs_journal_cnode *j_cnode_free_list; |
| 216 | struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ | 216 | struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */ |
| 217 | 217 | ||
| 218 | struct reiserfs_journal_list *j_current_jl; | 218 | struct reiserfs_journal_list *j_current_jl; |
| 219 | int j_free_bitmap_nodes ; | 219 | int j_free_bitmap_nodes; |
| 220 | int j_used_bitmap_nodes ; | 220 | int j_used_bitmap_nodes; |
| 221 | 221 | ||
| 222 | int j_num_lists; /* total number of active transactions */ | 222 | int j_num_lists; /* total number of active transactions */ |
| 223 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | 223 | int j_num_work_lists; /* number that need attention from kreiserfsd */ |
| 224 | 224 | ||
| 225 | /* debugging to make sure things are flushed in order */ | 225 | /* debugging to make sure things are flushed in order */ |
| 226 | int j_last_flush_id; | 226 | int j_last_flush_id; |
| 227 | 227 | ||
| 228 | /* debugging to make sure things are committed in order */ | 228 | /* debugging to make sure things are committed in order */ |
| 229 | int j_last_commit_id; | 229 | int j_last_commit_id; |
| 230 | 230 | ||
| 231 | struct list_head j_bitmap_nodes ; | 231 | struct list_head j_bitmap_nodes; |
| 232 | struct list_head j_dirty_buffers ; | 232 | struct list_head j_dirty_buffers; |
| 233 | spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */ | 233 | spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */ |
| 234 | 234 | ||
| 235 | /* list of all active transactions */ | 235 | /* list of all active transactions */ |
| 236 | struct list_head j_journal_list; | 236 | struct list_head j_journal_list; |
| 237 | /* lists that haven't been touched by writeback attempts */ | 237 | /* lists that haven't been touched by writeback attempts */ |
| 238 | struct list_head j_working_list; | 238 | struct list_head j_working_list; |
| 239 | 239 | ||
| 240 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ | 240 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ |
| 241 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ | 241 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ |
| 242 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all | 242 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all |
| 243 | the transactions */ | 243 | the transactions */ |
| 244 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | 244 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ |
| 245 | int j_persistent_trans; | 245 | int j_persistent_trans; |
| 246 | unsigned long j_max_trans_size ; | 246 | unsigned long j_max_trans_size; |
| 247 | unsigned long j_max_batch_size ; | 247 | unsigned long j_max_batch_size; |
| 248 | 248 | ||
| 249 | int j_errno; | 249 | int j_errno; |
| 250 | 250 | ||
| 251 | /* when flushing ordered buffers, throttle new ordered writers */ | 251 | /* when flushing ordered buffers, throttle new ordered writers */ |
| 252 | struct work_struct j_work; | 252 | struct work_struct j_work; |
| 253 | atomic_t j_async_throttle; | 253 | atomic_t j_async_throttle; |
| 254 | }; | 254 | }; |
| 255 | 255 | ||
| 256 | enum journal_state_bits { | 256 | enum journal_state_bits { |
| 257 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ | 257 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ |
| 258 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ | 258 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ |
| 259 | J_ABORTED, /* set when log is aborted */ | 259 | J_ABORTED, /* set when log is aborted */ |
| 260 | }; | 260 | }; |
| 261 | 261 | ||
| 262 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | ||
| 262 | 263 | ||
| 263 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | 264 | typedef __u32(*hashf_t) (const signed char *, int); |
| 264 | 265 | ||
| 265 | typedef __u32 (*hashf_t) (const signed char *, int); | 266 | struct reiserfs_bitmap_info { |
| 266 | 267 | // FIXME: Won't work with block sizes > 8K | |
| 267 | struct reiserfs_bitmap_info | 268 | __u16 first_zero_hint; |
| 268 | { | 269 | __u16 free_count; |
| 269 | // FIXME: Won't work with block sizes > 8K | 270 | struct buffer_head *bh; /* the actual bitmap */ |
| 270 | __u16 first_zero_hint; | ||
| 271 | __u16 free_count; | ||
| 272 | struct buffer_head *bh; /* the actual bitmap */ | ||
| 273 | }; | 271 | }; |
| 274 | 272 | ||
| 275 | struct proc_dir_entry; | 273 | struct proc_dir_entry; |
| 276 | 274 | ||
| 277 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | 275 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) |
| 278 | typedef unsigned long int stat_cnt_t; | 276 | typedef unsigned long int stat_cnt_t; |
| 279 | typedef struct reiserfs_proc_info_data | 277 | typedef struct reiserfs_proc_info_data { |
| 280 | { | 278 | spinlock_t lock; |
| 281 | spinlock_t lock; | 279 | int exiting; |
| 282 | int exiting; | 280 | int max_hash_collisions; |
| 283 | int max_hash_collisions; | 281 | |
| 284 | 282 | stat_cnt_t breads; | |
| 285 | stat_cnt_t breads; | 283 | stat_cnt_t bread_miss; |
| 286 | stat_cnt_t bread_miss; | 284 | stat_cnt_t search_by_key; |
| 287 | stat_cnt_t search_by_key; | 285 | stat_cnt_t search_by_key_fs_changed; |
| 288 | stat_cnt_t search_by_key_fs_changed; | 286 | stat_cnt_t search_by_key_restarted; |
| 289 | stat_cnt_t search_by_key_restarted; | 287 | |
| 290 | 288 | stat_cnt_t insert_item_restarted; | |
| 291 | stat_cnt_t insert_item_restarted; | 289 | stat_cnt_t paste_into_item_restarted; |
| 292 | stat_cnt_t paste_into_item_restarted; | 290 | stat_cnt_t cut_from_item_restarted; |
| 293 | stat_cnt_t cut_from_item_restarted; | 291 | stat_cnt_t delete_solid_item_restarted; |
| 294 | stat_cnt_t delete_solid_item_restarted; | 292 | stat_cnt_t delete_item_restarted; |
| 295 | stat_cnt_t delete_item_restarted; | 293 | |
| 296 | 294 | stat_cnt_t leaked_oid; | |
| 297 | stat_cnt_t leaked_oid; | 295 | stat_cnt_t leaves_removable; |
| 298 | stat_cnt_t leaves_removable; | 296 | |
| 299 | 297 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | |
| 300 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | 298 | stat_cnt_t balance_at[5]; /* XXX */ |
| 301 | stat_cnt_t balance_at[ 5 ]; /* XXX */ | 299 | /* sbk == search_by_key */ |
| 302 | /* sbk == search_by_key */ | 300 | stat_cnt_t sbk_read_at[5]; /* XXX */ |
| 303 | stat_cnt_t sbk_read_at[ 5 ]; /* XXX */ | 301 | stat_cnt_t sbk_fs_changed[5]; |
| 304 | stat_cnt_t sbk_fs_changed[ 5 ]; | 302 | stat_cnt_t sbk_restarted[5]; |
| 305 | stat_cnt_t sbk_restarted[ 5 ]; | 303 | stat_cnt_t items_at[5]; /* XXX */ |
| 306 | stat_cnt_t items_at[ 5 ]; /* XXX */ | 304 | stat_cnt_t free_at[5]; /* XXX */ |
| 307 | stat_cnt_t free_at[ 5 ]; /* XXX */ | 305 | stat_cnt_t can_node_be_removed[5]; /* XXX */ |
| 308 | stat_cnt_t can_node_be_removed[ 5 ]; /* XXX */ | 306 | long int lnum[5]; /* XXX */ |
| 309 | long int lnum[ 5 ]; /* XXX */ | 307 | long int rnum[5]; /* XXX */ |
| 310 | long int rnum[ 5 ]; /* XXX */ | 308 | long int lbytes[5]; /* XXX */ |
| 311 | long int lbytes[ 5 ]; /* XXX */ | 309 | long int rbytes[5]; /* XXX */ |
| 312 | long int rbytes[ 5 ]; /* XXX */ | 310 | stat_cnt_t get_neighbors[5]; |
| 313 | stat_cnt_t get_neighbors[ 5 ]; | 311 | stat_cnt_t get_neighbors_restart[5]; |
| 314 | stat_cnt_t get_neighbors_restart[ 5 ]; | 312 | stat_cnt_t need_l_neighbor[5]; |
| 315 | stat_cnt_t need_l_neighbor[ 5 ]; | 313 | stat_cnt_t need_r_neighbor[5]; |
| 316 | stat_cnt_t need_r_neighbor[ 5 ]; | 314 | |
| 317 | 315 | stat_cnt_t free_block; | |
| 318 | stat_cnt_t free_block; | 316 | struct __scan_bitmap_stats { |
| 319 | struct __scan_bitmap_stats { | 317 | stat_cnt_t call; |
| 320 | stat_cnt_t call; | 318 | stat_cnt_t wait; |
| 321 | stat_cnt_t wait; | 319 | stat_cnt_t bmap; |
| 322 | stat_cnt_t bmap; | 320 | stat_cnt_t retry; |
| 323 | stat_cnt_t retry; | 321 | stat_cnt_t in_journal_hint; |
| 324 | stat_cnt_t in_journal_hint; | 322 | stat_cnt_t in_journal_nohint; |
| 325 | stat_cnt_t in_journal_nohint; | 323 | stat_cnt_t stolen; |
| 326 | stat_cnt_t stolen; | 324 | } scan_bitmap; |
| 327 | } scan_bitmap; | 325 | struct __journal_stats { |
| 328 | struct __journal_stats { | 326 | stat_cnt_t in_journal; |
| 329 | stat_cnt_t in_journal; | 327 | stat_cnt_t in_journal_bitmap; |
| 330 | stat_cnt_t in_journal_bitmap; | 328 | stat_cnt_t in_journal_reusable; |
| 331 | stat_cnt_t in_journal_reusable; | 329 | stat_cnt_t lock_journal; |
| 332 | stat_cnt_t lock_journal; | 330 | stat_cnt_t lock_journal_wait; |
| 333 | stat_cnt_t lock_journal_wait; | 331 | stat_cnt_t journal_being; |
| 334 | stat_cnt_t journal_being; | 332 | stat_cnt_t journal_relock_writers; |
| 335 | stat_cnt_t journal_relock_writers; | 333 | stat_cnt_t journal_relock_wcount; |
| 336 | stat_cnt_t journal_relock_wcount; | 334 | stat_cnt_t mark_dirty; |
| 337 | stat_cnt_t mark_dirty; | 335 | stat_cnt_t mark_dirty_already; |
| 338 | stat_cnt_t mark_dirty_already; | 336 | stat_cnt_t mark_dirty_notjournal; |
| 339 | stat_cnt_t mark_dirty_notjournal; | 337 | stat_cnt_t restore_prepared; |
| 340 | stat_cnt_t restore_prepared; | 338 | stat_cnt_t prepare; |
| 341 | stat_cnt_t prepare; | 339 | stat_cnt_t prepare_retry; |
| 342 | stat_cnt_t prepare_retry; | 340 | } journal; |
| 343 | } journal; | ||
| 344 | } reiserfs_proc_info_data_t; | 341 | } reiserfs_proc_info_data_t; |
| 345 | #else | 342 | #else |
| 346 | typedef struct reiserfs_proc_info_data | 343 | typedef struct reiserfs_proc_info_data { |
| 347 | {} reiserfs_proc_info_data_t; | 344 | } reiserfs_proc_info_data_t; |
| 348 | #endif | 345 | #endif |
| 349 | 346 | ||
| 350 | /* reiserfs union of in-core super block data */ | 347 | /* reiserfs union of in-core super block data */ |
| 351 | struct reiserfs_sb_info | 348 | struct reiserfs_sb_info { |
| 352 | { | 349 | struct buffer_head *s_sbh; /* Buffer containing the super block */ |
| 353 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | 350 | /* both the comment and the choice of |
| 354 | /* both the comment and the choice of | 351 | name are unclear for s_rs -Hans */ |
| 355 | name are unclear for s_rs -Hans */ | 352 | struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */ |
| 356 | struct reiserfs_super_block * s_rs; /* Pointer to the super block in the buffer */ | 353 | struct reiserfs_bitmap_info *s_ap_bitmap; |
| 357 | struct reiserfs_bitmap_info * s_ap_bitmap; | 354 | struct reiserfs_journal *s_journal; /* pointer to journal information */ |
| 358 | struct reiserfs_journal *s_journal ; /* pointer to journal information */ | 355 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ |
| 359 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | 356 | |
| 360 | 357 | /* Comment? -Hans */ | |
| 361 | /* Comment? -Hans */ | 358 | void (*end_io_handler) (struct buffer_head *, int); |
| 362 | void (*end_io_handler)(struct buffer_head *, int); | 359 | hashf_t s_hash_function; /* pointer to function which is used |
| 363 | hashf_t s_hash_function; /* pointer to function which is used | 360 | to sort names in directory. Set on |
| 364 | to sort names in directory. Set on | 361 | mount */ |
| 365 | mount */ | 362 | unsigned long s_mount_opt; /* reiserfs's mount options are set |
| 366 | unsigned long s_mount_opt; /* reiserfs's mount options are set | 363 | here (currently - NOTAIL, NOLOG, |
| 367 | here (currently - NOTAIL, NOLOG, | 364 | REPLAYONLY) */ |
| 368 | REPLAYONLY) */ | 365 | |
| 369 | 366 | struct { /* This is a structure that describes block allocator options */ | |
| 370 | struct { /* This is a structure that describes block allocator options */ | 367 | unsigned long bits; /* Bitfield for enable/disable kind of options */ |
| 371 | unsigned long bits; /* Bitfield for enable/disable kind of options */ | 368 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ |
| 372 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ | 369 | int border; /* percentage of disk, border takes */ |
| 373 | int border; /* percentage of disk, border takes */ | 370 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ |
| 374 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ | 371 | int preallocsize; /* Number of blocks we try to prealloc when file |
| 375 | int preallocsize; /* Number of blocks we try to prealloc when file | 372 | reaches preallocmin size (in blocks) or |
| 376 | reaches preallocmin size (in blocks) or | 373 | prealloc_list is empty. */ |
| 377 | prealloc_list is empty. */ | 374 | } s_alloc_options; |
| 378 | } s_alloc_options; | 375 | |
| 379 | 376 | /* Comment? -Hans */ | |
| 380 | /* Comment? -Hans */ | 377 | wait_queue_head_t s_wait; |
| 381 | wait_queue_head_t s_wait; | 378 | /* To be obsoleted soon by per buffer seals.. -Hans */ |
| 382 | /* To be obsoleted soon by per buffer seals.. -Hans */ | 379 | atomic_t s_generation_counter; // increased by one every time the |
| 383 | atomic_t s_generation_counter; // increased by one every time the | 380 | // tree gets re-balanced |
| 384 | // tree gets re-balanced | 381 | unsigned long s_properties; /* File system properties. Currently holds |
| 385 | unsigned long s_properties; /* File system properties. Currently holds | 382 | on-disk FS format */ |
| 386 | on-disk FS format */ | 383 | |
| 387 | 384 | /* session statistics */ | |
| 388 | /* session statistics */ | 385 | int s_kmallocs; |
| 389 | int s_kmallocs; | 386 | int s_disk_reads; |
| 390 | int s_disk_reads; | 387 | int s_disk_writes; |
| 391 | int s_disk_writes; | 388 | int s_fix_nodes; |
| 392 | int s_fix_nodes; | 389 | int s_do_balance; |
| 393 | int s_do_balance; | 390 | int s_unneeded_left_neighbor; |
| 394 | int s_unneeded_left_neighbor; | 391 | int s_good_search_by_key_reada; |
| 395 | int s_good_search_by_key_reada; | 392 | int s_bmaps; |
| 396 | int s_bmaps; | 393 | int s_bmaps_without_search; |
| 397 | int s_bmaps_without_search; | 394 | int s_direct2indirect; |
| 398 | int s_direct2indirect; | 395 | int s_indirect2direct; |
| 399 | int s_indirect2direct; | ||
| 400 | /* set up when it's ok for reiserfs_read_inode2() to read from | 396 | /* set up when it's ok for reiserfs_read_inode2() to read from |
| 401 | disk inode with nlink==0. Currently this is only used during | 397 | disk inode with nlink==0. Currently this is only used during |
| 402 | finish_unfinished() processing at mount time */ | 398 | finish_unfinished() processing at mount time */ |
| 403 | int s_is_unlinked_ok; | 399 | int s_is_unlinked_ok; |
| 404 | reiserfs_proc_info_data_t s_proc_info_data; | 400 | reiserfs_proc_info_data_t s_proc_info_data; |
| 405 | struct proc_dir_entry *procdir; | 401 | struct proc_dir_entry *procdir; |
| 406 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | 402 | int reserved_blocks; /* amount of blocks reserved for further allocations */ |
| 407 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | 403 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ |
| 408 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | 404 | struct dentry *priv_root; /* root of /.reiserfs_priv */ |
| 409 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ | 405 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ |
| 410 | struct rw_semaphore xattr_dir_sem; | 406 | struct rw_semaphore xattr_dir_sem; |
| 411 | 407 | ||
| 412 | int j_errno; | 408 | int j_errno; |
| 413 | #ifdef CONFIG_QUOTA | 409 | #ifdef CONFIG_QUOTA |
| 414 | char *s_qf_names[MAXQUOTAS]; | 410 | char *s_qf_names[MAXQUOTAS]; |
| 415 | int s_jquota_fmt; | 411 | int s_jquota_fmt; |
| 416 | #endif | 412 | #endif |
| 417 | }; | 413 | }; |
| 418 | 414 | ||
| @@ -422,14 +418,14 @@ struct reiserfs_sb_info | |||
| 422 | 418 | ||
| 423 | enum reiserfs_mount_options { | 419 | enum reiserfs_mount_options { |
| 424 | /* Mount options */ | 420 | /* Mount options */ |
| 425 | REISERFS_LARGETAIL, /* large tails will be created in a session */ | 421 | REISERFS_LARGETAIL, /* large tails will be created in a session */ |
| 426 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ | 422 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ |
| 427 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ | 423 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ |
| 428 | REISERFS_CONVERT, /* -o conv: causes conversion of old | 424 | REISERFS_CONVERT, /* -o conv: causes conversion of old |
| 429 | format super block to the new | 425 | format super block to the new |
| 430 | format. If not specified - old | 426 | format. If not specified - old |
| 431 | partition will be dealt with in a | 427 | partition will be dealt with in a |
| 432 | manner of 3.5.x */ | 428 | manner of 3.5.x */ |
| 433 | 429 | ||
| 434 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | 430 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting |
| 435 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | 431 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option |
| @@ -439,41 +435,41 @@ enum reiserfs_mount_options { | |||
| 439 | ** the existing hash on the FS, so if you have a tea hash disk, and mount | 435 | ** the existing hash on the FS, so if you have a tea hash disk, and mount |
| 440 | ** with -o hash=rupasov, the mount will fail. | 436 | ** with -o hash=rupasov, the mount will fail. |
| 441 | */ | 437 | */ |
| 442 | FORCE_TEA_HASH, /* try to force tea hash on mount */ | 438 | FORCE_TEA_HASH, /* try to force tea hash on mount */ |
| 443 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ | 439 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ |
| 444 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ | 440 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ |
| 445 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ | 441 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ |
| 446 | 442 | ||
| 447 | REISERFS_DATA_LOG, | 443 | REISERFS_DATA_LOG, |
| 448 | REISERFS_DATA_ORDERED, | 444 | REISERFS_DATA_ORDERED, |
| 449 | REISERFS_DATA_WRITEBACK, | 445 | REISERFS_DATA_WRITEBACK, |
| 450 | 446 | ||
| 451 | /* used for testing experimental features, makes benchmarking new | 447 | /* used for testing experimental features, makes benchmarking new |
| 452 | features with and without more convenient, should never be used by | 448 | features with and without more convenient, should never be used by |
| 453 | users in any code shipped to users (ideally) */ | 449 | users in any code shipped to users (ideally) */ |
| 454 | 450 | ||
| 455 | REISERFS_NO_BORDER, | 451 | REISERFS_NO_BORDER, |
| 456 | REISERFS_NO_UNHASHED_RELOCATION, | 452 | REISERFS_NO_UNHASHED_RELOCATION, |
| 457 | REISERFS_HASHED_RELOCATION, | 453 | REISERFS_HASHED_RELOCATION, |
| 458 | REISERFS_ATTRS, | 454 | REISERFS_ATTRS, |
| 459 | REISERFS_XATTRS, | 455 | REISERFS_XATTRS, |
| 460 | REISERFS_XATTRS_USER, | 456 | REISERFS_XATTRS_USER, |
| 461 | REISERFS_POSIXACL, | 457 | REISERFS_POSIXACL, |
| 462 | REISERFS_BARRIER_NONE, | 458 | REISERFS_BARRIER_NONE, |
| 463 | REISERFS_BARRIER_FLUSH, | 459 | REISERFS_BARRIER_FLUSH, |
| 464 | 460 | ||
| 465 | /* Actions on error */ | 461 | /* Actions on error */ |
| 466 | REISERFS_ERROR_PANIC, | 462 | REISERFS_ERROR_PANIC, |
| 467 | REISERFS_ERROR_RO, | 463 | REISERFS_ERROR_RO, |
| 468 | REISERFS_ERROR_CONTINUE, | 464 | REISERFS_ERROR_CONTINUE, |
| 469 | 465 | ||
| 470 | REISERFS_QUOTA, /* Some quota option specified */ | 466 | REISERFS_QUOTA, /* Some quota option specified */ |
| 471 | 467 | ||
| 472 | REISERFS_TEST1, | 468 | REISERFS_TEST1, |
| 473 | REISERFS_TEST2, | 469 | REISERFS_TEST2, |
| 474 | REISERFS_TEST3, | 470 | REISERFS_TEST3, |
| 475 | REISERFS_TEST4, | 471 | REISERFS_TEST4, |
| 476 | REISERFS_UNSUPPORTED_OPT, | 472 | REISERFS_UNSUPPORTED_OPT, |
| 477 | }; | 473 | }; |
| 478 | 474 | ||
| 479 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) | 475 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) |
| @@ -504,18 +500,17 @@ enum reiserfs_mount_options { | |||
| 504 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) | 500 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) |
| 505 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) | 501 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) |
| 506 | 502 | ||
| 507 | void reiserfs_file_buffer (struct buffer_head * bh, int list); | 503 | void reiserfs_file_buffer(struct buffer_head *bh, int list); |
| 508 | extern struct file_system_type reiserfs_fs_type; | 504 | extern struct file_system_type reiserfs_fs_type; |
| 509 | int reiserfs_resize(struct super_block *, unsigned long) ; | 505 | int reiserfs_resize(struct super_block *, unsigned long); |
| 510 | 506 | ||
| 511 | #define CARRY_ON 0 | 507 | #define CARRY_ON 0 |
| 512 | #define SCHEDULE_OCCURRED 1 | 508 | #define SCHEDULE_OCCURRED 1 |
| 513 | 509 | ||
| 514 | |||
| 515 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) | 510 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) |
| 516 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) | 511 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) |
| 517 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) | 512 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) |
| 518 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) | 513 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) |
| 519 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) | 514 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) |
| 520 | 515 | ||
| 521 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) | 516 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) |
| @@ -525,13 +520,14 @@ int reiserfs_resize(struct super_block *, unsigned long) ; | |||
| 525 | */ | 520 | */ |
| 526 | static inline char *reiserfs_bdevname(struct super_block *s) | 521 | static inline char *reiserfs_bdevname(struct super_block *s) |
| 527 | { | 522 | { |
| 528 | return (s == NULL) ? "Null superblock" : s -> s_id; | 523 | return (s == NULL) ? "Null superblock" : s->s_id; |
| 529 | } | 524 | } |
| 530 | 525 | ||
| 531 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) | 526 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) |
| 532 | static inline int __reiserfs_is_journal_aborted (struct reiserfs_journal *journal) | 527 | static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal |
| 528 | *journal) | ||
| 533 | { | 529 | { |
| 534 | return test_bit (J_ABORTED, &journal->j_state); | 530 | return test_bit(J_ABORTED, &journal->j_state); |
| 535 | } | 531 | } |
| 536 | 532 | ||
| 537 | #endif /* _LINUX_REISER_FS_SB */ | 533 | #endif /* _LINUX_REISER_FS_SB */ |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 9244c5748820..c84354e8374c 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
| @@ -7,48 +7,48 @@ | |||
| 7 | #include <linux/xattr.h> | 7 | #include <linux/xattr.h> |
| 8 | 8 | ||
| 9 | /* Magic value in header */ | 9 | /* Magic value in header */ |
| 10 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ | 10 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ |
| 11 | 11 | ||
| 12 | struct reiserfs_xattr_header { | 12 | struct reiserfs_xattr_header { |
| 13 | __le32 h_magic; /* magic number for identification */ | 13 | __le32 h_magic; /* magic number for identification */ |
| 14 | __le32 h_hash; /* hash of the value */ | 14 | __le32 h_hash; /* hash of the value */ |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
| 18 | 18 | ||
| 19 | struct reiserfs_xattr_handler { | 19 | struct reiserfs_xattr_handler { |
| 20 | char *prefix; | 20 | char *prefix; |
| 21 | int (*init)(void); | 21 | int (*init) (void); |
| 22 | void (*exit)(void); | 22 | void (*exit) (void); |
| 23 | int (*get)(struct inode *inode, const char *name, void *buffer, | 23 | int (*get) (struct inode * inode, const char *name, void *buffer, |
| 24 | size_t size); | 24 | size_t size); |
| 25 | int (*set)(struct inode *inode, const char *name, const void *buffer, | 25 | int (*set) (struct inode * inode, const char *name, const void *buffer, |
| 26 | size_t size, int flags); | 26 | size_t size, int flags); |
| 27 | int (*del)(struct inode *inode, const char *name); | 27 | int (*del) (struct inode * inode, const char *name); |
| 28 | int (*list)(struct inode *inode, const char *name, int namelen, char *out); | 28 | int (*list) (struct inode * inode, const char *name, int namelen, |
| 29 | struct list_head handlers; | 29 | char *out); |
| 30 | struct list_head handlers; | ||
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | |||
| 33 | #ifdef CONFIG_REISERFS_FS_XATTR | 33 | #ifdef CONFIG_REISERFS_FS_XATTR |
| 34 | #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) | 34 | #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) |
| 35 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | 35 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) |
| 36 | ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name, | 36 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, |
| 37 | void *buffer, size_t size); | 37 | void *buffer, size_t size); |
| 38 | int reiserfs_setxattr (struct dentry *dentry, const char *name, | 38 | int reiserfs_setxattr(struct dentry *dentry, const char *name, |
| 39 | const void *value, size_t size, int flags); | 39 | const void *value, size_t size, int flags); |
| 40 | ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size); | 40 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
| 41 | int reiserfs_removexattr (struct dentry *dentry, const char *name); | 41 | int reiserfs_removexattr(struct dentry *dentry, const char *name); |
| 42 | int reiserfs_delete_xattrs (struct inode *inode); | 42 | int reiserfs_delete_xattrs(struct inode *inode); |
| 43 | int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs); | 43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); |
| 44 | int reiserfs_xattr_init (struct super_block *sb, int mount_flags); | 44 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
| 45 | int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd); | 45 | int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd); |
| 46 | int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd); | 46 | int reiserfs_permission_locked(struct inode *inode, int mask, |
| 47 | 47 | struct nameidata *nd); | |
| 48 | int reiserfs_xattr_del (struct inode *, const char *); | 48 | |
| 49 | int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t); | 49 | int reiserfs_xattr_del(struct inode *, const char *); |
| 50 | int reiserfs_xattr_set (struct inode *, const char *, const void *, | 50 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); |
| 51 | size_t, int); | 51 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); |
| 52 | 52 | ||
| 53 | extern struct reiserfs_xattr_handler user_handler; | 53 | extern struct reiserfs_xattr_handler user_handler; |
| 54 | extern struct reiserfs_xattr_handler trusted_handler; | 54 | extern struct reiserfs_xattr_handler trusted_handler; |
| @@ -56,57 +56,48 @@ extern struct reiserfs_xattr_handler trusted_handler; | |||
| 56 | extern struct reiserfs_xattr_handler security_handler; | 56 | extern struct reiserfs_xattr_handler security_handler; |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | int reiserfs_xattr_register_handlers (void) __init; | 59 | int reiserfs_xattr_register_handlers(void) __init; |
| 60 | void reiserfs_xattr_unregister_handlers (void); | 60 | void reiserfs_xattr_unregister_handlers(void); |
| 61 | 61 | ||
| 62 | static inline void | 62 | static inline void reiserfs_write_lock_xattrs(struct super_block *sb) |
| 63 | reiserfs_write_lock_xattrs(struct super_block *sb) | ||
| 64 | { | 63 | { |
| 65 | down_write (&REISERFS_XATTR_DIR_SEM(sb)); | 64 | down_write(&REISERFS_XATTR_DIR_SEM(sb)); |
| 66 | } | 65 | } |
| 67 | static inline void | 66 | static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) |
| 68 | reiserfs_write_unlock_xattrs(struct super_block *sb) | ||
| 69 | { | 67 | { |
| 70 | up_write (&REISERFS_XATTR_DIR_SEM(sb)); | 68 | up_write(&REISERFS_XATTR_DIR_SEM(sb)); |
| 71 | } | 69 | } |
| 72 | static inline void | 70 | static inline void reiserfs_read_lock_xattrs(struct super_block *sb) |
| 73 | reiserfs_read_lock_xattrs(struct super_block *sb) | ||
| 74 | { | 71 | { |
| 75 | down_read (&REISERFS_XATTR_DIR_SEM(sb)); | 72 | down_read(&REISERFS_XATTR_DIR_SEM(sb)); |
| 76 | } | 73 | } |
| 77 | 74 | ||
| 78 | static inline void | 75 | static inline void reiserfs_read_unlock_xattrs(struct super_block *sb) |
| 79 | reiserfs_read_unlock_xattrs(struct super_block *sb) | ||
| 80 | { | 76 | { |
| 81 | up_read (&REISERFS_XATTR_DIR_SEM(sb)); | 77 | up_read(&REISERFS_XATTR_DIR_SEM(sb)); |
| 82 | } | 78 | } |
| 83 | 79 | ||
| 84 | static inline void | 80 | static inline void reiserfs_write_lock_xattr_i(struct inode *inode) |
| 85 | reiserfs_write_lock_xattr_i(struct inode *inode) | ||
| 86 | { | 81 | { |
| 87 | down_write (&REISERFS_I(inode)->xattr_sem); | 82 | down_write(&REISERFS_I(inode)->xattr_sem); |
| 88 | } | 83 | } |
| 89 | static inline void | 84 | static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) |
| 90 | reiserfs_write_unlock_xattr_i(struct inode *inode) | ||
| 91 | { | 85 | { |
| 92 | up_write (&REISERFS_I(inode)->xattr_sem); | 86 | up_write(&REISERFS_I(inode)->xattr_sem); |
| 93 | } | 87 | } |
| 94 | static inline void | 88 | static inline void reiserfs_read_lock_xattr_i(struct inode *inode) |
| 95 | reiserfs_read_lock_xattr_i(struct inode *inode) | ||
| 96 | { | 89 | { |
| 97 | down_read (&REISERFS_I(inode)->xattr_sem); | 90 | down_read(&REISERFS_I(inode)->xattr_sem); |
| 98 | } | 91 | } |
| 99 | 92 | ||
| 100 | static inline void | 93 | static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) |
| 101 | reiserfs_read_unlock_xattr_i(struct inode *inode) | ||
| 102 | { | 94 | { |
| 103 | up_read (&REISERFS_I(inode)->xattr_sem); | 95 | up_read(&REISERFS_I(inode)->xattr_sem); |
| 104 | } | 96 | } |
| 105 | 97 | ||
| 106 | static inline void | 98 | static inline void reiserfs_mark_inode_private(struct inode *inode) |
| 107 | reiserfs_mark_inode_private(struct inode *inode) | ||
| 108 | { | 99 | { |
| 109 | inode->i_flags |= S_PRIVATE; | 100 | inode->i_flags |= S_PRIVATE; |
| 110 | } | 101 | } |
| 111 | 102 | ||
| 112 | #else | 103 | #else |
| @@ -127,13 +118,20 @@ reiserfs_mark_inode_private(struct inode *inode) | |||
| 127 | #define reiserfs_xattr_register_handlers() 0 | 118 | #define reiserfs_xattr_register_handlers() 0 |
| 128 | #define reiserfs_xattr_unregister_handlers() | 119 | #define reiserfs_xattr_unregister_handlers() |
| 129 | 120 | ||
| 130 | static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; }; | 121 | static inline int reiserfs_delete_xattrs(struct inode *inode) |
| 131 | static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; }; | 122 | { |
| 132 | static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags) | 123 | return 0; |
| 124 | }; | ||
| 125 | static inline int reiserfs_chown_xattrs(struct inode *inode, | ||
| 126 | struct iattr *attrs) | ||
| 127 | { | ||
| 128 | return 0; | ||
| 129 | }; | ||
| 130 | static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) | ||
| 133 | { | 131 | { |
| 134 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ | 132 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ |
| 135 | return 0; | 133 | return 0; |
| 136 | }; | 134 | }; |
| 137 | #endif | 135 | #endif |
| 138 | 136 | ||
| 139 | #endif /* __KERNEL__ */ | 137 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ff48815bd3a2..dec5827c7742 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -410,6 +410,10 @@ struct user_struct { | |||
| 410 | atomic_t processes; /* How many processes does this user have? */ | 410 | atomic_t processes; /* How many processes does this user have? */ |
| 411 | atomic_t files; /* How many open files does this user have? */ | 411 | atomic_t files; /* How many open files does this user have? */ |
| 412 | atomic_t sigpending; /* How many pending signals does this user have? */ | 412 | atomic_t sigpending; /* How many pending signals does this user have? */ |
| 413 | #ifdef CONFIG_INOTIFY | ||
| 414 | atomic_t inotify_watches; /* How many inotify watches does this user have? */ | ||
| 415 | atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ | ||
| 416 | #endif | ||
| 413 | /* protected by mq_lock */ | 417 | /* protected by mq_lock */ |
| 414 | unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ | 418 | unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ |
| 415 | unsigned long locked_shm; /* How many pages of mlocked shm ? */ | 419 | unsigned long locked_shm; /* How many pages of mlocked shm ? */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 416a2e4024b2..5d4a990d5577 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -183,7 +183,6 @@ struct skb_shared_info { | |||
| 183 | * @priority: Packet queueing priority | 183 | * @priority: Packet queueing priority |
| 184 | * @users: User count - see {datagram,tcp}.c | 184 | * @users: User count - see {datagram,tcp}.c |
| 185 | * @protocol: Packet protocol from driver | 185 | * @protocol: Packet protocol from driver |
| 186 | * @security: Security level of packet | ||
| 187 | * @truesize: Buffer size | 186 | * @truesize: Buffer size |
| 188 | * @head: Head of buffer | 187 | * @head: Head of buffer |
| 189 | * @data: Data head pointer | 188 | * @data: Data head pointer |
| @@ -249,18 +248,18 @@ struct sk_buff { | |||
| 249 | data_len, | 248 | data_len, |
| 250 | mac_len, | 249 | mac_len, |
| 251 | csum; | 250 | csum; |
| 252 | unsigned char local_df, | ||
| 253 | cloned:1, | ||
| 254 | nohdr:1, | ||
| 255 | pkt_type, | ||
| 256 | ip_summed; | ||
| 257 | __u32 priority; | 251 | __u32 priority; |
| 258 | unsigned short protocol, | 252 | __u8 local_df:1, |
| 259 | security; | 253 | cloned:1, |
| 254 | ip_summed:2, | ||
| 255 | nohdr:1; | ||
| 256 | /* 3 bits spare */ | ||
| 257 | __u8 pkt_type; | ||
| 258 | __u16 protocol; | ||
| 260 | 259 | ||
| 261 | void (*destructor)(struct sk_buff *skb); | 260 | void (*destructor)(struct sk_buff *skb); |
| 262 | #ifdef CONFIG_NETFILTER | 261 | #ifdef CONFIG_NETFILTER |
| 263 | unsigned long nfmark; | 262 | unsigned long nfmark; |
| 264 | __u32 nfcache; | 263 | __u32 nfcache; |
| 265 | __u32 nfctinfo; | 264 | __u32 nfctinfo; |
| 266 | struct nf_conntrack *nfct; | 265 | struct nf_conntrack *nfct; |
| @@ -301,20 +300,26 @@ struct sk_buff { | |||
| 301 | #include <asm/system.h> | 300 | #include <asm/system.h> |
| 302 | 301 | ||
| 303 | extern void __kfree_skb(struct sk_buff *skb); | 302 | extern void __kfree_skb(struct sk_buff *skb); |
| 304 | extern struct sk_buff *alloc_skb(unsigned int size, int priority); | 303 | extern struct sk_buff *alloc_skb(unsigned int size, |
| 304 | unsigned int __nocast priority); | ||
| 305 | extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, | 305 | extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, |
| 306 | unsigned int size, int priority); | 306 | unsigned int size, |
| 307 | unsigned int __nocast priority); | ||
| 307 | extern void kfree_skbmem(struct sk_buff *skb); | 308 | extern void kfree_skbmem(struct sk_buff *skb); |
| 308 | extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority); | 309 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
| 309 | extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority); | 310 | unsigned int __nocast priority); |
| 310 | extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask); | 311 | extern struct sk_buff *skb_copy(const struct sk_buff *skb, |
| 312 | unsigned int __nocast priority); | ||
| 313 | extern struct sk_buff *pskb_copy(struct sk_buff *skb, | ||
| 314 | unsigned int __nocast gfp_mask); | ||
| 311 | extern int pskb_expand_head(struct sk_buff *skb, | 315 | extern int pskb_expand_head(struct sk_buff *skb, |
| 312 | int nhead, int ntail, int gfp_mask); | 316 | int nhead, int ntail, |
| 317 | unsigned int __nocast gfp_mask); | ||
| 313 | extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, | 318 | extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, |
| 314 | unsigned int headroom); | 319 | unsigned int headroom); |
| 315 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | 320 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, |
| 316 | int newheadroom, int newtailroom, | 321 | int newheadroom, int newtailroom, |
| 317 | int priority); | 322 | unsigned int __nocast priority); |
| 318 | extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); | 323 | extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); |
| 319 | #define dev_kfree_skb(a) kfree_skb(a) | 324 | #define dev_kfree_skb(a) kfree_skb(a) |
| 320 | extern void skb_over_panic(struct sk_buff *skb, int len, | 325 | extern void skb_over_panic(struct sk_buff *skb, int len, |
| @@ -465,7 +470,8 @@ static inline int skb_shared(const struct sk_buff *skb) | |||
| 465 | * | 470 | * |
| 466 | * NULL is returned on a memory allocation failure. | 471 | * NULL is returned on a memory allocation failure. |
| 467 | */ | 472 | */ |
| 468 | static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) | 473 | static inline struct sk_buff *skb_share_check(struct sk_buff *skb, |
| 474 | unsigned int __nocast pri) | ||
| 469 | { | 475 | { |
| 470 | might_sleep_if(pri & __GFP_WAIT); | 476 | might_sleep_if(pri & __GFP_WAIT); |
| 471 | if (skb_shared(skb)) { | 477 | if (skb_shared(skb)) { |
| @@ -1002,7 +1008,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) | |||
| 1002 | * %NULL is returned in there is no free memory. | 1008 | * %NULL is returned in there is no free memory. |
| 1003 | */ | 1009 | */ |
| 1004 | static inline struct sk_buff *__dev_alloc_skb(unsigned int length, | 1010 | static inline struct sk_buff *__dev_alloc_skb(unsigned int length, |
| 1005 | int gfp_mask) | 1011 | unsigned int __nocast gfp_mask) |
| 1006 | { | 1012 | { |
| 1007 | struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); | 1013 | struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); |
| 1008 | if (likely(skb)) | 1014 | if (likely(skb)) |
| @@ -1115,8 +1121,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i, | |||
| 1115 | * If there is no free memory -ENOMEM is returned, otherwise zero | 1121 | * If there is no free memory -ENOMEM is returned, otherwise zero |
| 1116 | * is returned and the old skb data released. | 1122 | * is returned and the old skb data released. |
| 1117 | */ | 1123 | */ |
| 1118 | extern int __skb_linearize(struct sk_buff *skb, int gfp); | 1124 | extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp); |
| 1119 | static inline int skb_linearize(struct sk_buff *skb, int gfp) | 1125 | static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp) |
| 1120 | { | 1126 | { |
| 1121 | return __skb_linearize(skb, gfp); | 1127 | return __skb_linearize(skb, gfp); |
| 1122 | } | 1128 | } |
| @@ -1211,7 +1217,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
| 1211 | { | 1217 | { |
| 1212 | int hlen = skb_headlen(skb); | 1218 | int hlen = skb_headlen(skb); |
| 1213 | 1219 | ||
| 1214 | if (offset + len <= hlen) | 1220 | if (hlen - offset >= len) |
| 1215 | return skb->data + offset; | 1221 | return skb->data + offset; |
| 1216 | 1222 | ||
| 1217 | if (skb_copy_bits(skb, offset, buffer, len) < 0) | 1223 | if (skb_copy_bits(skb, offset, buffer, len) < 0) |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 76cf7e60216c..4c8e552471b0 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -65,7 +65,7 @@ extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); | |||
| 65 | extern void kmem_cache_free(kmem_cache_t *, void *); | 65 | extern void kmem_cache_free(kmem_cache_t *, void *); |
| 66 | extern unsigned int kmem_cache_size(kmem_cache_t *); | 66 | extern unsigned int kmem_cache_size(kmem_cache_t *); |
| 67 | extern const char *kmem_cache_name(kmem_cache_t *); | 67 | extern const char *kmem_cache_name(kmem_cache_t *); |
| 68 | extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); | 68 | extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags); |
| 69 | 69 | ||
| 70 | /* Size description struct for general caches. */ | 70 | /* Size description struct for general caches. */ |
| 71 | struct cache_sizes { | 71 | struct cache_sizes { |
| @@ -105,7 +105,7 @@ extern unsigned int ksize(const void *); | |||
| 105 | 105 | ||
| 106 | #ifdef CONFIG_NUMA | 106 | #ifdef CONFIG_NUMA |
| 107 | extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); | 107 | extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); |
| 108 | extern void *kmalloc_node(size_t size, int flags, int node); | 108 | extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); |
| 109 | #else | 109 | #else |
| 110 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) | 110 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) |
| 111 | { | 111 | { |
diff --git a/include/linux/string.h b/include/linux/string.h index 93994c613095..dab2652acbd8 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t); | |||
| 88 | extern void * memchr(const void *,int,__kernel_size_t); | 88 | extern void * memchr(const void *,int,__kernel_size_t); |
| 89 | #endif | 89 | #endif |
| 90 | 90 | ||
| 91 | extern char *kstrdup(const char *s, int gfp); | 91 | extern char *kstrdup(const char *s, unsigned int __nocast gfp); |
| 92 | 92 | ||
| 93 | #ifdef __cplusplus | 93 | #ifdef __cplusplus |
| 94 | } | 94 | } |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 2343f999e6e1..239f520cc49e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #include <linux/mmzone.h> | 7 | #include <linux/mmzone.h> |
| 8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
| 9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
| 10 | #include <linux/pagemap.h> | ||
| 11 | |||
| 10 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
| 11 | #include <asm/page.h> | 13 | #include <asm/page.h> |
| 12 | 14 | ||
| @@ -148,7 +150,7 @@ struct swap_list_t { | |||
| 148 | #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) | 150 | #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) |
| 149 | 151 | ||
| 150 | /* linux/mm/oom_kill.c */ | 152 | /* linux/mm/oom_kill.c */ |
| 151 | extern void out_of_memory(unsigned int __nocast gfp_mask); | 153 | extern void out_of_memory(unsigned int __nocast gfp_mask, int order); |
| 152 | 154 | ||
| 153 | /* linux/mm/memory.c */ | 155 | /* linux/mm/memory.c */ |
| 154 | extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); | 156 | extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 52830b6d94e5..425f58c8ea4a 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -506,4 +506,7 @@ asmlinkage long sys_request_key(const char __user *_type, | |||
| 506 | asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3, | 506 | asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3, |
| 507 | unsigned long arg4, unsigned long arg5); | 507 | unsigned long arg4, unsigned long arg5); |
| 508 | 508 | ||
| 509 | asmlinkage long sys_ioprio_set(int which, int who, int ioprio); | ||
| 510 | asmlinkage long sys_ioprio_get(int which, int who); | ||
| 511 | |||
| 509 | #endif | 512 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 5b5f434ac9a0..bfbbe94b297d 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -70,6 +70,14 @@ enum | |||
| 70 | CTL_BUS_ISA=1 /* ISA */ | 70 | CTL_BUS_ISA=1 /* ISA */ |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | /* /proc/sys/fs/inotify/ */ | ||
| 74 | enum | ||
| 75 | { | ||
| 76 | INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */ | ||
| 77 | INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */ | ||
| 78 | INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */ | ||
| 79 | }; | ||
| 80 | |||
| 73 | /* CTL_KERN names: */ | 81 | /* CTL_KERN names: */ |
| 74 | enum | 82 | enum |
| 75 | { | 83 | { |
| @@ -676,6 +684,7 @@ enum | |||
| 676 | FS_XFS=17, /* struct: control xfs parameters */ | 684 | FS_XFS=17, /* struct: control xfs parameters */ |
| 677 | FS_AIO_NR=18, /* current system-wide number of aio requests */ | 685 | FS_AIO_NR=18, /* current system-wide number of aio requests */ |
| 678 | FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ | 686 | FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ |
| 687 | FS_INOTIFY=20, /* inotify submenu */ | ||
| 679 | }; | 688 | }; |
| 680 | 689 | ||
| 681 | /* /proc/sys/fs/quota/ */ | 690 | /* /proc/sys/fs/quota/ */ |
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h index a6b2cc530af5..bcb762d93123 100644 --- a/include/linux/tc_ematch/tc_em_meta.h +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
| @@ -45,7 +45,7 @@ enum | |||
| 45 | TCF_META_ID_REALDEV, | 45 | TCF_META_ID_REALDEV, |
| 46 | TCF_META_ID_PRIORITY, | 46 | TCF_META_ID_PRIORITY, |
| 47 | TCF_META_ID_PROTOCOL, | 47 | TCF_META_ID_PROTOCOL, |
| 48 | TCF_META_ID_SECURITY, | 48 | TCF_META_ID_SECURITY, /* obsolete */ |
| 49 | TCF_META_ID_PKTTYPE, | 49 | TCF_META_ID_PKTTYPE, |
| 50 | TCF_META_ID_PKTLEN, | 50 | TCF_META_ID_PKTLEN, |
| 51 | TCF_META_ID_DATALEN, | 51 | TCF_META_ID_DATALEN, |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index dfd93d03f5d2..e4fd82e42104 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -286,7 +286,7 @@ struct tcp_sock { | |||
| 286 | __u32 max_window; /* Maximal window ever seen from peer */ | 286 | __u32 max_window; /* Maximal window ever seen from peer */ |
| 287 | __u32 pmtu_cookie; /* Last pmtu seen by socket */ | 287 | __u32 pmtu_cookie; /* Last pmtu seen by socket */ |
| 288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ |
| 289 | __u16 mss_cache_std; /* Like mss_cache, but without TSO */ | 289 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ |
| 290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ | 290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ |
| 291 | __u8 ca_state; /* State of fast-retransmit machine */ | 291 | __u8 ca_state; /* State of fast-retransmit machine */ |
| 292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ | 292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index eb282b581546..724637792996 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -938,17 +938,17 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
| 938 | } | 938 | } |
| 939 | 939 | ||
| 940 | extern void usb_init_urb(struct urb *urb); | 940 | extern void usb_init_urb(struct urb *urb); |
| 941 | extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags); | 941 | extern struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags); |
| 942 | extern void usb_free_urb(struct urb *urb); | 942 | extern void usb_free_urb(struct urb *urb); |
| 943 | #define usb_put_urb usb_free_urb | 943 | #define usb_put_urb usb_free_urb |
| 944 | extern struct urb *usb_get_urb(struct urb *urb); | 944 | extern struct urb *usb_get_urb(struct urb *urb); |
| 945 | extern int usb_submit_urb(struct urb *urb, int mem_flags); | 945 | extern int usb_submit_urb(struct urb *urb, unsigned mem_flags); |
| 946 | extern int usb_unlink_urb(struct urb *urb); | 946 | extern int usb_unlink_urb(struct urb *urb); |
| 947 | extern void usb_kill_urb(struct urb *urb); | 947 | extern void usb_kill_urb(struct urb *urb); |
| 948 | 948 | ||
| 949 | #define HAVE_USB_BUFFERS | 949 | #define HAVE_USB_BUFFERS |
| 950 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 950 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
| 951 | int mem_flags, dma_addr_t *dma); | 951 | unsigned mem_flags, dma_addr_t *dma); |
| 952 | void usb_buffer_free (struct usb_device *dev, size_t size, | 952 | void usb_buffer_free (struct usb_device *dev, size_t size, |
| 953 | void *addr, dma_addr_t dma); | 953 | void *addr, dma_addr_t dma); |
| 954 | 954 | ||
| @@ -1055,7 +1055,7 @@ int usb_sg_init ( | |||
| 1055 | struct scatterlist *sg, | 1055 | struct scatterlist *sg, |
| 1056 | int nents, | 1056 | int nents, |
| 1057 | size_t length, | 1057 | size_t length, |
| 1058 | int mem_flags | 1058 | unsigned mem_flags |
| 1059 | ); | 1059 | ); |
| 1060 | void usb_sg_cancel (struct usb_sg_request *io); | 1060 | void usb_sg_cancel (struct usb_sg_request *io); |
| 1061 | void usb_sg_wait (struct usb_sg_request *io); | 1061 | void usb_sg_wait (struct usb_sg_request *io); |
diff --git a/include/linux/usb_cdc.h b/include/linux/usb_cdc.h index f22d6beecc73..ba617c372455 100644 --- a/include/linux/usb_cdc.h +++ b/include/linux/usb_cdc.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ | 34 | #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ |
| 35 | #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ | 35 | #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ |
| 36 | #define USB_CDC_COUNTRY_TYPE 0x07 | 36 | #define USB_CDC_COUNTRY_TYPE 0x07 |
| 37 | #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ | ||
| 37 | #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ | 38 | #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ |
| 38 | #define USB_CDC_WHCM_TYPE 0x11 | 39 | #define USB_CDC_WHCM_TYPE 0x11 |
| 39 | #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ | 40 | #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ |
| @@ -83,6 +84,18 @@ struct usb_cdc_union_desc { | |||
| 83 | /* ... and there could be other slave interfaces */ | 84 | /* ... and there could be other slave interfaces */ |
| 84 | } __attribute__ ((packed)); | 85 | } __attribute__ ((packed)); |
| 85 | 86 | ||
| 87 | /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ | ||
| 88 | struct usb_cdc_network_terminal_desc { | ||
| 89 | __u8 bLength; | ||
| 90 | __u8 bDescriptorType; | ||
| 91 | __u8 bDescriptorSubType; | ||
| 92 | |||
| 93 | __u8 bEntityId; | ||
| 94 | __u8 iName; | ||
| 95 | __u8 bChannelIndex; | ||
| 96 | __u8 bPhysicalInterface; | ||
| 97 | } __attribute__ ((packed)); | ||
| 98 | |||
| 86 | /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ | 99 | /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ |
| 87 | struct usb_cdc_ether_desc { | 100 | struct usb_cdc_ether_desc { |
| 88 | __u8 bLength; | 101 | __u8 bLength; |
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h index b00f127cb447..71e608607324 100644 --- a/include/linux/usb_gadget.h +++ b/include/linux/usb_gadget.h | |||
| @@ -107,18 +107,18 @@ struct usb_ep_ops { | |||
| 107 | int (*disable) (struct usb_ep *ep); | 107 | int (*disable) (struct usb_ep *ep); |
| 108 | 108 | ||
| 109 | struct usb_request *(*alloc_request) (struct usb_ep *ep, | 109 | struct usb_request *(*alloc_request) (struct usb_ep *ep, |
| 110 | int gfp_flags); | 110 | unsigned gfp_flags); |
| 111 | void (*free_request) (struct usb_ep *ep, struct usb_request *req); | 111 | void (*free_request) (struct usb_ep *ep, struct usb_request *req); |
| 112 | 112 | ||
| 113 | void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes, | 113 | void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes, |
| 114 | dma_addr_t *dma, int gfp_flags); | 114 | dma_addr_t *dma, unsigned gfp_flags); |
| 115 | void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma, | 115 | void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma, |
| 116 | unsigned bytes); | 116 | unsigned bytes); |
| 117 | // NOTE: on 2.6, drivers may also use dma_map() and | 117 | // NOTE: on 2.6, drivers may also use dma_map() and |
| 118 | // dma_sync_single_*() to directly manage dma overhead. | 118 | // dma_sync_single_*() to directly manage dma overhead. |
| 119 | 119 | ||
| 120 | int (*queue) (struct usb_ep *ep, struct usb_request *req, | 120 | int (*queue) (struct usb_ep *ep, struct usb_request *req, |
| 121 | int gfp_flags); | 121 | unsigned gfp_flags); |
| 122 | int (*dequeue) (struct usb_ep *ep, struct usb_request *req); | 122 | int (*dequeue) (struct usb_ep *ep, struct usb_request *req); |
| 123 | 123 | ||
| 124 | int (*set_halt) (struct usb_ep *ep, int value); | 124 | int (*set_halt) (struct usb_ep *ep, int value); |
| @@ -214,7 +214,7 @@ usb_ep_disable (struct usb_ep *ep) | |||
| 214 | * Returns the request, or null if one could not be allocated. | 214 | * Returns the request, or null if one could not be allocated. |
| 215 | */ | 215 | */ |
| 216 | static inline struct usb_request * | 216 | static inline struct usb_request * |
| 217 | usb_ep_alloc_request (struct usb_ep *ep, int gfp_flags) | 217 | usb_ep_alloc_request (struct usb_ep *ep, unsigned gfp_flags) |
| 218 | { | 218 | { |
| 219 | return ep->ops->alloc_request (ep, gfp_flags); | 219 | return ep->ops->alloc_request (ep, gfp_flags); |
| 220 | } | 220 | } |
| @@ -254,7 +254,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) | |||
| 254 | */ | 254 | */ |
| 255 | static inline void * | 255 | static inline void * |
| 256 | usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma, | 256 | usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma, |
| 257 | int gfp_flags) | 257 | unsigned gfp_flags) |
| 258 | { | 258 | { |
| 259 | return ep->ops->alloc_buffer (ep, len, dma, gfp_flags); | 259 | return ep->ops->alloc_buffer (ep, len, dma, gfp_flags); |
| 260 | } | 260 | } |
| @@ -330,7 +330,7 @@ usb_ep_free_buffer (struct usb_ep *ep, void *buf, dma_addr_t dma, unsigned len) | |||
| 330 | * reported when the usb peripheral is disconnected. | 330 | * reported when the usb peripheral is disconnected. |
| 331 | */ | 331 | */ |
| 332 | static inline int | 332 | static inline int |
| 333 | usb_ep_queue (struct usb_ep *ep, struct usb_request *req, int gfp_flags) | 333 | usb_ep_queue (struct usb_ep *ep, struct usb_request *req, unsigned gfp_flags) |
| 334 | { | 334 | { |
| 335 | return ep->ops->queue (ep, req, gfp_flags); | 335 | return ep->ops->queue (ep, req, gfp_flags); |
| 336 | } | 336 | } |
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 3e89f0f15f49..1b6b76a4eb54 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h | |||
| @@ -516,8 +516,7 @@ struct wan_device { | |||
| 516 | /* Public functions available for device drivers */ | 516 | /* Public functions available for device drivers */ |
| 517 | extern int register_wan_device(struct wan_device *wandev); | 517 | extern int register_wan_device(struct wan_device *wandev); |
| 518 | extern int unregister_wan_device(char *name); | 518 | extern int unregister_wan_device(char *name); |
| 519 | unsigned short wanrouter_type_trans(struct sk_buff *skb, | 519 | __be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev); |
| 520 | struct net_device *dev); | ||
| 521 | int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, | 520 | int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, |
| 522 | unsigned short type); | 521 | unsigned short type); |
| 523 | 522 | ||
