diff options
Diffstat (limited to 'include/linux')
134 files changed, 4752 insertions, 2357 deletions
diff --git a/include/linux/8250_pci.h b/include/linux/8250_pci.h index 5f3ab21b339b..3209dd46ea7d 100644 --- a/include/linux/8250_pci.h +++ b/include/linux/8250_pci.h | |||
| @@ -1,2 +1,37 @@ | |||
| 1 | int pci_siig10x_fn(struct pci_dev *dev, int enable); | 1 | /* |
| 2 | int pci_siig20x_fn(struct pci_dev *dev, int enable); | 2 | * Definitions for PCI support. |
| 3 | */ | ||
| 4 | #define FL_BASE_MASK 0x0007 | ||
| 5 | #define FL_BASE0 0x0000 | ||
| 6 | #define FL_BASE1 0x0001 | ||
| 7 | #define FL_BASE2 0x0002 | ||
| 8 | #define FL_BASE3 0x0003 | ||
| 9 | #define FL_BASE4 0x0004 | ||
| 10 | #define FL_GET_BASE(x) (x & FL_BASE_MASK) | ||
| 11 | |||
| 12 | /* Use successive BARs (PCI base address registers), | ||
| 13 | else use offset into some specified BAR */ | ||
| 14 | #define FL_BASE_BARS 0x0008 | ||
| 15 | |||
| 16 | /* do not assign an irq */ | ||
| 17 | #define FL_NOIRQ 0x0080 | ||
| 18 | |||
| 19 | /* Use the Base address register size to cap number of ports */ | ||
| 20 | #define FL_REGION_SZ_CAP 0x0100 | ||
| 21 | |||
| 22 | struct pciserial_board { | ||
| 23 | unsigned int flags; | ||
| 24 | unsigned int num_ports; | ||
| 25 | unsigned int base_baud; | ||
| 26 | unsigned int uart_offset; | ||
| 27 | unsigned int reg_shift; | ||
| 28 | unsigned int first_offset; | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct serial_private; | ||
| 32 | |||
| 33 | struct serial_private * | ||
| 34 | pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board); | ||
| 35 | void pciserial_remove_ports(struct serial_private *priv); | ||
| 36 | void pciserial_suspend_ports(struct serial_private *priv); | ||
| 37 | void pciserial_resume_ports(struct serial_private *priv); | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ef8483673aa3..b46a5205ee7b 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 { |
| @@ -450,9 +453,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | |||
| 450 | * If this matches the last registration, any IRQ resources for gsi | 453 | * If this matches the last registration, any IRQ resources for gsi |
| 451 | * are freed. | 454 | * are freed. |
| 452 | */ | 455 | */ |
| 453 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | ||
| 454 | void acpi_unregister_gsi (u32 gsi); | 456 | void acpi_unregister_gsi (u32 gsi); |
| 455 | #endif | ||
| 456 | 457 | ||
| 457 | #ifdef CONFIG_ACPI_PCI | 458 | #ifdef CONFIG_ACPI_PCI |
| 458 | 459 | ||
| @@ -475,11 +476,9 @@ struct acpi_prt_list { | |||
| 475 | struct pci_dev; | 476 | struct pci_dev; |
| 476 | 477 | ||
| 477 | int acpi_pci_irq_enable (struct pci_dev *dev); | 478 | int acpi_pci_irq_enable (struct pci_dev *dev); |
| 478 | void acpi_penalize_isa_irq(int irq); | 479 | void acpi_penalize_isa_irq(int irq, int active); |
| 479 | 480 | ||
| 480 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | ||
| 481 | void acpi_pci_irq_disable (struct pci_dev *dev); | 481 | void acpi_pci_irq_disable (struct pci_dev *dev); |
| 482 | #endif | ||
| 483 | 482 | ||
| 484 | struct acpi_pci_driver { | 483 | struct acpi_pci_driver { |
| 485 | struct acpi_pci_driver *next; | 484 | struct acpi_pci_driver *next; |
diff --git a/include/linux/ata.h b/include/linux/ata.h index ca5fcadf9981..a5b74efab067 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
| @@ -1,24 +1,29 @@ | |||
| 1 | 1 | ||
| 2 | /* | 2 | /* |
| 3 | Copyright 2003-2004 Red Hat, Inc. All rights reserved. | 3 | * Copyright 2003-2004 Red Hat, Inc. All rights reserved. |
| 4 | Copyright 2003-2004 Jeff Garzik | 4 | * Copyright 2003-2004 Jeff Garzik |
| 5 | 5 | * | |
| 6 | The contents of this file are subject to the Open | 6 | * |
| 7 | Software License version 1.1 that can be found at | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | http://www.opensource.org/licenses/osl-1.1.txt and is included herein | 8 | * it under the terms of the GNU General Public License as published by |
| 9 | by reference. | 9 | * the Free Software Foundation; either version 2, or (at your option) |
| 10 | 10 | * any later version. | |
| 11 | Alternatively, the contents of this file may be used under the terms | 11 | * |
| 12 | of the GNU General Public License version 2 (the "GPL") as distributed | 12 | * This program is distributed in the hope that it will be useful, |
| 13 | in the kernel source COPYING file, in which case the provisions of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | the GPL are applicable instead of the above. If you wish to allow | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | the use of your version of this file only under the terms of the | 15 | * GNU General Public License for more details. |
| 16 | GPL and not to allow others to use your version of this file under | 16 | * |
| 17 | the OSL, indicate your decision by deleting the provisions above and | 17 | * You should have received a copy of the GNU General Public License |
| 18 | replace them with the notice and other provisions required by the GPL. | 18 | * along with this program; see the file COPYING. If not, write to |
| 19 | If you do not delete the provisions above, a recipient may use your | 19 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | version of this file under either the OSL or the GPL. | 20 | * |
| 21 | 21 | * | |
| 22 | * libata documentation is available via 'make {ps|pdf}docs', | ||
| 23 | * as Documentation/DocBook/libata.* | ||
| 24 | * | ||
| 25 | * Hardware documentation available from http://www.t13.org/ | ||
| 26 | * | ||
| 22 | */ | 27 | */ |
| 23 | 28 | ||
| 24 | #ifndef __LINUX_ATA_H__ | 29 | #ifndef __LINUX_ATA_H__ |
| @@ -108,6 +113,8 @@ enum { | |||
| 108 | 113 | ||
| 109 | /* ATA device commands */ | 114 | /* ATA device commands */ |
| 110 | ATA_CMD_CHK_POWER = 0xE5, /* check power mode */ | 115 | ATA_CMD_CHK_POWER = 0xE5, /* check power mode */ |
| 116 | ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */ | ||
| 117 | ATA_CMD_IDLE = 0xE3, /* place in idle power mode */ | ||
| 111 | ATA_CMD_EDD = 0x90, /* execute device diagnostic */ | 118 | ATA_CMD_EDD = 0x90, /* execute device diagnostic */ |
| 112 | ATA_CMD_FLUSH = 0xE7, | 119 | ATA_CMD_FLUSH = 0xE7, |
| 113 | ATA_CMD_FLUSH_EXT = 0xEA, | 120 | ATA_CMD_FLUSH_EXT = 0xEA, |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0881b5cdee3d..19bd8e7e11bf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -301,6 +301,7 @@ struct blk_queue_tag { | |||
| 301 | struct list_head busy_list; /* fifo list of busy tags */ | 301 | struct list_head busy_list; /* fifo list of busy tags */ |
| 302 | int busy; /* current depth */ | 302 | int busy; /* current depth */ |
| 303 | int max_depth; /* what we will send to device */ | 303 | int max_depth; /* what we will send to device */ |
| 304 | int real_max_depth; /* what the array can hold */ | ||
| 304 | atomic_t refcnt; /* map can be shared */ | 305 | atomic_t refcnt; /* map can be shared */ |
| 305 | }; | 306 | }; |
| 306 | 307 | ||
diff --git a/include/linux/capability.h b/include/linux/capability.h index 8d139f4acf23..6b4618902d3d 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -233,6 +233,7 @@ typedef __u32 kernel_cap_t; | |||
| 233 | /* Allow enabling/disabling tagged queuing on SCSI controllers and sending | 233 | /* Allow enabling/disabling tagged queuing on SCSI controllers and sending |
| 234 | arbitrary SCSI commands */ | 234 | arbitrary SCSI commands */ |
| 235 | /* Allow setting encryption key on loopback filesystem */ | 235 | /* Allow setting encryption key on loopback filesystem */ |
| 236 | /* Allow setting zone reclaim policy */ | ||
| 236 | 237 | ||
| 237 | #define CAP_SYS_ADMIN 21 | 238 | #define CAP_SYS_ADMIN 21 |
| 238 | 239 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index e8904c0da686..86980c68234a 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * Basic handling of the devices is done in drivers/base/cpu.c | 8 | * Basic handling of the devices is done in drivers/base/cpu.c |
| 9 | * and system devices are handled in drivers/base/sys.c. | 9 | * and system devices are handled in drivers/base/sys.c. |
| 10 | * | 10 | * |
| 11 | * CPUs are exported via driverfs in the class/cpu/devices/ | 11 | * CPUs are exported via sysfs in the class/cpu/devices/ |
| 12 | * directory. | 12 | * directory. |
| 13 | * | 13 | * |
| 14 | * Per-cpu interfaces can be implemented using a struct device_interface. | 14 | * Per-cpu interfaces can be implemented using a struct device_interface. |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 5e2bcc636a02..3c89df6e7768 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | #define CRYPTO_TFM_MODE_CTR 0x00000008 | 45 | #define CRYPTO_TFM_MODE_CTR 0x00000008 |
| 46 | 46 | ||
| 47 | #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 | 47 | #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 |
| 48 | #define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 | ||
| 48 | #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 | 49 | #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 |
| 49 | #define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 | 50 | #define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 |
| 50 | #define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 | 51 | #define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h new file mode 100644 index 000000000000..007c290f74d4 --- /dev/null +++ b/include/linux/dccp.h | |||
| @@ -0,0 +1,456 @@ | |||
| 1 | #ifndef _LINUX_DCCP_H | ||
| 2 | #define _LINUX_DCCP_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <asm/byteorder.h> | ||
| 6 | |||
| 7 | /* Structure describing an Internet (DCCP) socket address. */ | ||
| 8 | struct sockaddr_dccp { | ||
| 9 | __u16 sdccp_family; /* Address family */ | ||
| 10 | __u16 sdccp_port; /* Port number */ | ||
| 11 | __u32 sdccp_addr; /* Internet address */ | ||
| 12 | __u32 sdccp_service; /* Service */ | ||
| 13 | /* Pad to size of `struct sockaddr': 16 bytes . */ | ||
| 14 | __u32 sdccp_pad; | ||
| 15 | }; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * struct dccp_hdr - generic part of DCCP packet header | ||
| 19 | * | ||
| 20 | * @dccph_sport - Relevant port on the endpoint that sent this packet | ||
| 21 | * @dccph_dport - Relevant port on the other endpoint | ||
| 22 | * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words | ||
| 23 | * @dccph_ccval - Used by the HC-Sender CCID | ||
| 24 | * @dccph_cscov - Parts of the packet that are covered by the Checksum field | ||
| 25 | * @dccph_checksum - Internet checksum, depends on dccph_cscov | ||
| 26 | * @dccph_x - 0 = 24 bit sequence number, 1 = 48 | ||
| 27 | * @dccph_type - packet type, see DCCP_PKT_ prefixed macros | ||
| 28 | * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x | ||
| 29 | */ | ||
| 30 | struct dccp_hdr { | ||
| 31 | __u16 dccph_sport, | ||
| 32 | dccph_dport; | ||
| 33 | __u8 dccph_doff; | ||
| 34 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 35 | __u8 dccph_cscov:4, | ||
| 36 | dccph_ccval:4; | ||
| 37 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 38 | __u8 dccph_ccval:4, | ||
| 39 | dccph_cscov:4; | ||
| 40 | #else | ||
| 41 | #error "Adjust your <asm/byteorder.h> defines" | ||
| 42 | #endif | ||
| 43 | __u16 dccph_checksum; | ||
| 44 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 45 | __u32 dccph_x:1, | ||
| 46 | dccph_type:4, | ||
| 47 | dccph_reserved:3, | ||
| 48 | dccph_seq:24; | ||
| 49 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 50 | __u32 dccph_reserved:3, | ||
| 51 | dccph_type:4, | ||
| 52 | dccph_x:1, | ||
| 53 | dccph_seq:24; | ||
| 54 | #else | ||
| 55 | #error "Adjust your <asm/byteorder.h> defines" | ||
| 56 | #endif | ||
| 57 | }; | ||
| 58 | |||
| 59 | /** | ||
| 60 | * struct dccp_hdr_ext - the low bits of a 48 bit seq packet | ||
| 61 | * | ||
| 62 | * @dccph_seq_low - low 24 bits of a 48 bit seq packet | ||
| 63 | */ | ||
| 64 | struct dccp_hdr_ext { | ||
| 65 | __u32 dccph_seq_low; | ||
| 66 | }; | ||
| 67 | |||
| 68 | /** | ||
| 69 | * struct dccp_hdr_request - Conection initiation request header | ||
| 70 | * | ||
| 71 | * @dccph_req_service - Service to which the client app wants to connect | ||
| 72 | * @dccph_req_options - list of options (must be a multiple of 32 bits | ||
| 73 | */ | ||
| 74 | struct dccp_hdr_request { | ||
| 75 | __u32 dccph_req_service; | ||
| 76 | }; | ||
| 77 | /** | ||
| 78 | * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets | ||
| 79 | * | ||
| 80 | * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR | ||
| 81 | * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR | ||
| 82 | */ | ||
| 83 | struct dccp_hdr_ack_bits { | ||
| 84 | __u32 dccph_reserved1:8, | ||
| 85 | dccph_ack_nr_high:24; | ||
| 86 | __u32 dccph_ack_nr_low; | ||
| 87 | }; | ||
| 88 | /** | ||
| 89 | * struct dccp_hdr_response - Conection initiation response header | ||
| 90 | * | ||
| 91 | * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR | ||
| 92 | * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR | ||
| 93 | * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request | ||
| 94 | * @dccph_resp_options - list of options (must be a multiple of 32 bits | ||
| 95 | */ | ||
| 96 | struct dccp_hdr_response { | ||
| 97 | struct dccp_hdr_ack_bits dccph_resp_ack; | ||
| 98 | __u32 dccph_resp_service; | ||
| 99 | }; | ||
| 100 | |||
| 101 | /** | ||
| 102 | * struct dccp_hdr_reset - Unconditionally shut down a connection | ||
| 103 | * | ||
| 104 | * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request | ||
| 105 | * @dccph_reset_options - list of options (must be a multiple of 32 bits | ||
| 106 | */ | ||
| 107 | struct dccp_hdr_reset { | ||
| 108 | struct dccp_hdr_ack_bits dccph_reset_ack; | ||
| 109 | __u8 dccph_reset_code, | ||
| 110 | dccph_reset_data[3]; | ||
| 111 | }; | ||
| 112 | |||
| 113 | enum dccp_pkt_type { | ||
| 114 | DCCP_PKT_REQUEST = 0, | ||
| 115 | DCCP_PKT_RESPONSE, | ||
| 116 | DCCP_PKT_DATA, | ||
| 117 | DCCP_PKT_ACK, | ||
| 118 | DCCP_PKT_DATAACK, | ||
| 119 | DCCP_PKT_CLOSEREQ, | ||
| 120 | DCCP_PKT_CLOSE, | ||
| 121 | DCCP_PKT_RESET, | ||
| 122 | DCCP_PKT_SYNC, | ||
| 123 | DCCP_PKT_SYNCACK, | ||
| 124 | DCCP_PKT_INVALID, | ||
| 125 | }; | ||
| 126 | |||
| 127 | #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID | ||
| 128 | |||
| 129 | static inline unsigned int dccp_packet_hdr_len(const __u8 type) | ||
| 130 | { | ||
| 131 | if (type == DCCP_PKT_DATA) | ||
| 132 | return 0; | ||
| 133 | if (type == DCCP_PKT_DATAACK || | ||
| 134 | type == DCCP_PKT_ACK || | ||
| 135 | type == DCCP_PKT_SYNC || | ||
| 136 | type == DCCP_PKT_SYNCACK || | ||
| 137 | type == DCCP_PKT_CLOSE || | ||
| 138 | type == DCCP_PKT_CLOSEREQ) | ||
| 139 | return sizeof(struct dccp_hdr_ack_bits); | ||
| 140 | if (type == DCCP_PKT_REQUEST) | ||
| 141 | return sizeof(struct dccp_hdr_request); | ||
| 142 | if (type == DCCP_PKT_RESPONSE) | ||
| 143 | return sizeof(struct dccp_hdr_response); | ||
| 144 | return sizeof(struct dccp_hdr_reset); | ||
| 145 | } | ||
| 146 | enum dccp_reset_codes { | ||
| 147 | DCCP_RESET_CODE_UNSPECIFIED = 0, | ||
| 148 | DCCP_RESET_CODE_CLOSED, | ||
| 149 | DCCP_RESET_CODE_ABORTED, | ||
| 150 | DCCP_RESET_CODE_NO_CONNECTION, | ||
| 151 | DCCP_RESET_CODE_PACKET_ERROR, | ||
| 152 | DCCP_RESET_CODE_OPTION_ERROR, | ||
| 153 | DCCP_RESET_CODE_MANDATORY_ERROR, | ||
| 154 | DCCP_RESET_CODE_CONNECTION_REFUSED, | ||
| 155 | DCCP_RESET_CODE_BAD_SERVICE_CODE, | ||
| 156 | DCCP_RESET_CODE_TOO_BUSY, | ||
| 157 | DCCP_RESET_CODE_BAD_INIT_COOKIE, | ||
| 158 | DCCP_RESET_CODE_AGGRESSION_PENALTY, | ||
| 159 | }; | ||
| 160 | |||
| 161 | /* DCCP options */ | ||
| 162 | enum { | ||
| 163 | DCCPO_PADDING = 0, | ||
| 164 | DCCPO_MANDATORY = 1, | ||
| 165 | DCCPO_MIN_RESERVED = 3, | ||
| 166 | DCCPO_MAX_RESERVED = 31, | ||
| 167 | DCCPO_NDP_COUNT = 37, | ||
| 168 | DCCPO_ACK_VECTOR_0 = 38, | ||
| 169 | DCCPO_ACK_VECTOR_1 = 39, | ||
| 170 | DCCPO_TIMESTAMP = 41, | ||
| 171 | DCCPO_TIMESTAMP_ECHO = 42, | ||
| 172 | DCCPO_ELAPSED_TIME = 43, | ||
| 173 | DCCPO_MAX = 45, | ||
| 174 | DCCPO_MIN_CCID_SPECIFIC = 128, | ||
| 175 | DCCPO_MAX_CCID_SPECIFIC = 255, | ||
| 176 | }; | ||
| 177 | |||
| 178 | /* DCCP features */ | ||
| 179 | enum { | ||
| 180 | DCCPF_RESERVED = 0, | ||
| 181 | DCCPF_SEQUENCE_WINDOW = 3, | ||
| 182 | DCCPF_SEND_ACK_VECTOR = 6, | ||
| 183 | DCCPF_SEND_NDP_COUNT = 7, | ||
| 184 | /* 10-127 reserved */ | ||
| 185 | DCCPF_MIN_CCID_SPECIFIC = 128, | ||
| 186 | DCCPF_MAX_CCID_SPECIFIC = 255, | ||
| 187 | }; | ||
| 188 | |||
| 189 | /* DCCP socket options */ | ||
| 190 | #define DCCP_SOCKOPT_PACKET_SIZE 1 | ||
| 191 | |||
| 192 | #ifdef __KERNEL__ | ||
| 193 | |||
| 194 | #include <linux/in.h> | ||
| 195 | #include <linux/list.h> | ||
| 196 | #include <linux/uio.h> | ||
| 197 | #include <linux/workqueue.h> | ||
| 198 | |||
| 199 | #include <net/inet_connection_sock.h> | ||
| 200 | #include <net/inet_timewait_sock.h> | ||
| 201 | #include <net/sock.h> | ||
| 202 | #include <net/tcp_states.h> | ||
| 203 | #include <net/tcp.h> | ||
| 204 | |||
| 205 | enum dccp_state { | ||
| 206 | DCCP_OPEN = TCP_ESTABLISHED, | ||
| 207 | DCCP_REQUESTING = TCP_SYN_SENT, | ||
| 208 | DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME: | ||
| 209 | This mapping is horrible, but TCP has | ||
| 210 | no matching state for DCCP_PARTOPEN, | ||
| 211 | as TCP_SYN_RECV is already used by | ||
| 212 | DCCP_RESPOND, why don't stop using TCP | ||
| 213 | mapping of states? OK, now we don't use | ||
| 214 | sk_stream_sendmsg anymore, so doesn't | ||
| 215 | seem to exist any reason for us to | ||
| 216 | do the TCP mapping here */ | ||
| 217 | DCCP_LISTEN = TCP_LISTEN, | ||
| 218 | DCCP_RESPOND = TCP_SYN_RECV, | ||
| 219 | DCCP_CLOSING = TCP_CLOSING, | ||
| 220 | DCCP_TIME_WAIT = TCP_TIME_WAIT, | ||
| 221 | DCCP_CLOSED = TCP_CLOSE, | ||
| 222 | DCCP_MAX_STATES = TCP_MAX_STATES, | ||
| 223 | }; | ||
| 224 | |||
| 225 | #define DCCP_STATE_MASK 0xf | ||
| 226 | #define DCCP_ACTION_FIN (1<<7) | ||
| 227 | |||
| 228 | enum { | ||
| 229 | DCCPF_OPEN = TCPF_ESTABLISHED, | ||
| 230 | DCCPF_REQUESTING = TCPF_SYN_SENT, | ||
| 231 | DCCPF_PARTOPEN = TCPF_FIN_WAIT1, | ||
| 232 | DCCPF_LISTEN = TCPF_LISTEN, | ||
| 233 | DCCPF_RESPOND = TCPF_SYN_RECV, | ||
| 234 | DCCPF_CLOSING = TCPF_CLOSING, | ||
| 235 | DCCPF_TIME_WAIT = TCPF_TIME_WAIT, | ||
| 236 | DCCPF_CLOSED = TCPF_CLOSE, | ||
| 237 | }; | ||
| 238 | |||
| 239 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) | ||
| 240 | { | ||
| 241 | return (struct dccp_hdr *)skb->h.raw; | ||
| 242 | } | ||
| 243 | |||
| 244 | static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) | ||
| 245 | { | ||
| 246 | return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) | ||
| 250 | { | ||
| 251 | return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0); | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb) | ||
| 255 | { | ||
| 256 | const struct dccp_hdr *dh = dccp_hdr(skb); | ||
| 257 | return __dccp_basic_hdr_len(dh); | ||
| 258 | } | ||
| 259 | |||
| 260 | static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) | ||
| 261 | { | ||
| 262 | const struct dccp_hdr *dh = dccp_hdr(skb); | ||
| 263 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 264 | __u64 seq_nr = ntohl(dh->dccph_seq << 8); | ||
| 265 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 266 | __u64 seq_nr = ntohl(dh->dccph_seq); | ||
| 267 | #else | ||
| 268 | #error "Adjust your <asm/byteorder.h> defines" | ||
| 269 | #endif | ||
| 270 | |||
| 271 | if (dh->dccph_x != 0) | ||
| 272 | seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low); | ||
| 273 | |||
| 274 | return seq_nr; | ||
| 275 | } | ||
| 276 | |||
| 277 | static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) | ||
| 278 | { | ||
| 279 | return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); | ||
| 280 | } | ||
| 281 | |||
| 282 | static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) | ||
| 283 | { | ||
| 284 | return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); | ||
| 285 | } | ||
| 286 | |||
| 287 | static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) | ||
| 288 | { | ||
| 289 | const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb); | ||
| 290 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 291 | return (((u64)ntohl(dhack->dccph_ack_nr_high << 8)) << 32) + ntohl(dhack->dccph_ack_nr_low); | ||
| 292 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 293 | return (((u64)ntohl(dhack->dccph_ack_nr_high)) << 32) + ntohl(dhack->dccph_ack_nr_low); | ||
| 294 | #else | ||
| 295 | #error "Adjust your <asm/byteorder.h> defines" | ||
| 296 | #endif | ||
| 297 | } | ||
| 298 | |||
| 299 | static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) | ||
| 300 | { | ||
| 301 | return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); | ||
| 302 | } | ||
| 303 | |||
| 304 | static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) | ||
| 305 | { | ||
| 306 | return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); | ||
| 307 | } | ||
| 308 | |||
| 309 | static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) | ||
| 310 | { | ||
| 311 | return __dccp_basic_hdr_len(dh) + | ||
| 312 | dccp_packet_hdr_len(dh->dccph_type); | ||
| 313 | } | ||
| 314 | |||
| 315 | static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | ||
| 316 | { | ||
| 317 | return __dccp_hdr_len(dccp_hdr(skb)); | ||
| 318 | } | ||
| 319 | |||
| 320 | |||
| 321 | /* initial values for each feature */ | ||
| 322 | #define DCCPF_INITIAL_SEQUENCE_WINDOW 100 | ||
| 323 | /* FIXME: for now we're using CCID 3 (TFRC) */ | ||
| 324 | #define DCCPF_INITIAL_CCID 3 | ||
| 325 | #define DCCPF_INITIAL_SEND_ACK_VECTOR 0 | ||
| 326 | /* FIXME: for now we're default to 1 but it should really be 0 */ | ||
| 327 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 | ||
| 328 | |||
| 329 | #define DCCP_NDP_LIMIT 0xFFFFFF | ||
| 330 | |||
| 331 | /** | ||
| 332 | * struct dccp_options - option values for a DCCP connection | ||
| 333 | * @dccpo_sequence_window - Sequence Window Feature (section 7.5.2) | ||
| 334 | * @dccpo_ccid - Congestion Control Id (CCID) (section 10) | ||
| 335 | * @dccpo_send_ack_vector - Send Ack Vector Feature (section 11.5) | ||
| 336 | * @dccpo_send_ndp_count - Send NDP Count Feature (7.7.2) | ||
| 337 | */ | ||
| 338 | struct dccp_options { | ||
| 339 | __u64 dccpo_sequence_window; | ||
| 340 | __u8 dccpo_ccid; | ||
| 341 | __u8 dccpo_send_ack_vector; | ||
| 342 | __u8 dccpo_send_ndp_count; | ||
| 343 | }; | ||
| 344 | |||
| 345 | extern void __dccp_options_init(struct dccp_options *dccpo); | ||
| 346 | extern void dccp_options_init(struct dccp_options *dccpo); | ||
| 347 | extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); | ||
| 348 | |||
| 349 | struct dccp_request_sock { | ||
| 350 | struct inet_request_sock dreq_inet_rsk; | ||
| 351 | __u64 dreq_iss; | ||
| 352 | __u64 dreq_isr; | ||
| 353 | __u32 dreq_service; | ||
| 354 | }; | ||
| 355 | |||
| 356 | static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | ||
| 357 | { | ||
| 358 | return (struct dccp_request_sock *)req; | ||
| 359 | } | ||
| 360 | |||
| 361 | extern struct inet_timewait_death_row dccp_death_row; | ||
| 362 | |||
| 363 | /* Read about the ECN nonce to see why it is 253 */ | ||
| 364 | #define DCCP_MAX_ACK_VECTOR_LEN 253 | ||
| 365 | |||
| 366 | struct dccp_options_received { | ||
| 367 | u32 dccpor_ndp:24, | ||
| 368 | dccpor_ack_vector_len:8; | ||
| 369 | u32 dccpor_ack_vector_idx:10; | ||
| 370 | /* 22 bits hole, try to pack */ | ||
| 371 | u32 dccpor_timestamp; | ||
| 372 | u32 dccpor_timestamp_echo; | ||
| 373 | u32 dccpor_elapsed_time; | ||
| 374 | }; | ||
| 375 | |||
| 376 | struct ccid; | ||
| 377 | |||
| 378 | enum dccp_role { | ||
| 379 | DCCP_ROLE_UNDEFINED, | ||
| 380 | DCCP_ROLE_LISTEN, | ||
| 381 | DCCP_ROLE_CLIENT, | ||
| 382 | DCCP_ROLE_SERVER, | ||
| 383 | }; | ||
| 384 | |||
| 385 | /** | ||
| 386 | * struct dccp_sock - DCCP socket state | ||
| 387 | * | ||
| 388 | * @dccps_swl - sequence number window low | ||
| 389 | * @dccps_swh - sequence number window high | ||
| 390 | * @dccps_awl - acknowledgement number window low | ||
| 391 | * @dccps_awh - acknowledgement number window high | ||
| 392 | * @dccps_iss - initial sequence number sent | ||
| 393 | * @dccps_isr - initial sequence number received | ||
| 394 | * @dccps_osr - first OPEN sequence number received | ||
| 395 | * @dccps_gss - greatest sequence number sent | ||
| 396 | * @dccps_gsr - greatest valid sequence number received | ||
| 397 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss | ||
| 398 | * @dccps_timestamp_time - time of latest TIMESTAMP option | ||
| 399 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option | ||
| 400 | * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options) | ||
| 401 | * @dccps_pmtu_cookie - Last pmtu seen by socket | ||
| 402 | * @dccps_packet_size - Set thru setsockopt | ||
| 403 | * @dccps_role - Role of this sock, one of %dccp_role | ||
| 404 | * @dccps_ndp_count - number of Non Data Packets since last data packet | ||
| 405 | * @dccps_hc_rx_ackpkts - receiver half connection acked packets | ||
| 406 | */ | ||
| 407 | struct dccp_sock { | ||
| 408 | /* inet_connection_sock has to be the first member of dccp_sock */ | ||
| 409 | struct inet_connection_sock dccps_inet_connection; | ||
| 410 | __u64 dccps_swl; | ||
| 411 | __u64 dccps_swh; | ||
| 412 | __u64 dccps_awl; | ||
| 413 | __u64 dccps_awh; | ||
| 414 | __u64 dccps_iss; | ||
| 415 | __u64 dccps_isr; | ||
| 416 | __u64 dccps_osr; | ||
| 417 | __u64 dccps_gss; | ||
| 418 | __u64 dccps_gsr; | ||
| 419 | __u64 dccps_gar; | ||
| 420 | unsigned long dccps_service; | ||
| 421 | struct timeval dccps_timestamp_time; | ||
| 422 | __u32 dccps_timestamp_echo; | ||
| 423 | __u32 dccps_packet_size; | ||
| 424 | unsigned long dccps_ndp_count; | ||
| 425 | __u16 dccps_ext_header_len; | ||
| 426 | __u32 dccps_pmtu_cookie; | ||
| 427 | __u32 dccps_mss_cache; | ||
| 428 | struct dccp_options dccps_options; | ||
| 429 | struct dccp_ackpkts *dccps_hc_rx_ackpkts; | ||
| 430 | void *dccps_hc_rx_ccid_private; | ||
| 431 | void *dccps_hc_tx_ccid_private; | ||
| 432 | struct ccid *dccps_hc_rx_ccid; | ||
| 433 | struct ccid *dccps_hc_tx_ccid; | ||
| 434 | struct dccp_options_received dccps_options_received; | ||
| 435 | enum dccp_role dccps_role:2; | ||
| 436 | }; | ||
| 437 | |||
| 438 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) | ||
| 439 | { | ||
| 440 | return (struct dccp_sock *)sk; | ||
| 441 | } | ||
| 442 | |||
| 443 | static inline const char *dccp_role(const struct sock *sk) | ||
| 444 | { | ||
| 445 | switch (dccp_sk(sk)->dccps_role) { | ||
| 446 | case DCCP_ROLE_UNDEFINED: return "undefined"; | ||
| 447 | case DCCP_ROLE_LISTEN: return "listen"; | ||
| 448 | case DCCP_ROLE_SERVER: return "server"; | ||
| 449 | case DCCP_ROLE_CLIENT: return "client"; | ||
| 450 | } | ||
| 451 | return NULL; | ||
| 452 | } | ||
| 453 | |||
| 454 | #endif /* __KERNEL__ */ | ||
| 455 | |||
| 456 | #endif /* _LINUX_DCCP_H */ | ||
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h index c28050136164..1d68428c925d 100644 --- a/include/linux/dcookies.h +++ b/include/linux/dcookies.h | |||
| @@ -48,12 +48,12 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
| 48 | 48 | ||
| 49 | #else | 49 | #else |
| 50 | 50 | ||
| 51 | struct dcookie_user * dcookie_register(void) | 51 | static inline struct dcookie_user * dcookie_register(void) |
| 52 | { | 52 | { |
| 53 | return NULL; | 53 | return NULL; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void dcookie_unregister(struct dcookie_user * user) | 56 | static inline void dcookie_unregister(struct dcookie_user * user) |
| 57 | { | 57 | { |
| 58 | return; | 58 | return; |
| 59 | } | 59 | } |
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/efi.h b/include/linux/efi.h index 73781ec165b4..c7c5dd316182 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -91,11 +91,6 @@ typedef struct { | |||
| 91 | 91 | ||
| 92 | #define EFI_PAGE_SHIFT 12 | 92 | #define EFI_PAGE_SHIFT 12 |
| 93 | 93 | ||
| 94 | /* | ||
| 95 | * For current x86 implementations of EFI, there is | ||
| 96 | * additional padding in the mem descriptors. This is not | ||
| 97 | * the case in ia64. Need to have this fixed in the f/w. | ||
| 98 | */ | ||
| 99 | typedef struct { | 94 | typedef struct { |
| 100 | u32 type; | 95 | u32 type; |
| 101 | u32 pad; | 96 | u32 pad; |
| @@ -103,9 +98,6 @@ typedef struct { | |||
| 103 | u64 virt_addr; | 98 | u64 virt_addr; |
| 104 | u64 num_pages; | 99 | u64 num_pages; |
| 105 | u64 attribute; | 100 | u64 attribute; |
| 106 | #if defined (__i386__) | ||
| 107 | u64 pad1; | ||
| 108 | #endif | ||
| 109 | } efi_memory_desc_t; | 101 | } efi_memory_desc_t; |
| 110 | 102 | ||
| 111 | typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg); | 103 | typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg); |
| @@ -240,10 +232,12 @@ typedef struct { | |||
| 240 | } efi_system_table_t; | 232 | } efi_system_table_t; |
| 241 | 233 | ||
| 242 | struct efi_memory_map { | 234 | struct efi_memory_map { |
| 243 | efi_memory_desc_t *phys_map; | 235 | void *phys_map; |
| 244 | efi_memory_desc_t *map; | 236 | void *map; |
| 237 | void *map_end; | ||
| 245 | int nr_map; | 238 | int nr_map; |
| 246 | unsigned long desc_version; | 239 | unsigned long desc_version; |
| 240 | unsigned long desc_size; | ||
| 247 | }; | 241 | }; |
| 248 | 242 | ||
| 249 | /* | 243 | /* |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index cf3847edc50f..4522c7186bf3 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, |
| @@ -69,6 +69,12 @@ static inline int is_multicast_ether_addr(const u8 *addr) | |||
| 69 | return ((addr[0] != 0xff) && (0x01 & addr[0])); | 69 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static inline int is_broadcast_ether_addr(const u8 *addr) | ||
| 73 | { | ||
| 74 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && | ||
| 75 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); | ||
| 76 | } | ||
| 77 | |||
| 72 | /** | 78 | /** |
| 73 | * is_valid_ether_addr - Determine if the given Ethernet address is valid | 79 | * is_valid_ether_addr - Determine if the given Ethernet address is valid |
| 74 | * @addr: Pointer to a six-byte array containing the Ethernet address | 80 | * @addr: Pointer to a six-byte array containing the Ethernet address |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index a0ab26aab450..ed1440ea4c91 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -250,6 +250,12 @@ struct ethtool_stats { | |||
| 250 | u64 data[0]; | 250 | u64 data[0]; |
| 251 | }; | 251 | }; |
| 252 | 252 | ||
| 253 | struct ethtool_perm_addr { | ||
| 254 | u32 cmd; /* ETHTOOL_GPERMADDR */ | ||
| 255 | u32 size; | ||
| 256 | u8 data[0]; | ||
| 257 | }; | ||
| 258 | |||
| 253 | struct net_device; | 259 | struct net_device; |
| 254 | 260 | ||
| 255 | /* Some generic methods drivers may use in their ethtool_ops */ | 261 | /* Some generic methods drivers may use in their ethtool_ops */ |
| @@ -261,6 +267,8 @@ u32 ethtool_op_get_sg(struct net_device *dev); | |||
| 261 | int ethtool_op_set_sg(struct net_device *dev, u32 data); | 267 | int ethtool_op_set_sg(struct net_device *dev, u32 data); |
| 262 | u32 ethtool_op_get_tso(struct net_device *dev); | 268 | u32 ethtool_op_get_tso(struct net_device *dev); |
| 263 | int ethtool_op_set_tso(struct net_device *dev, u32 data); | 269 | int ethtool_op_set_tso(struct net_device *dev, u32 data); |
| 270 | int ethtool_op_get_perm_addr(struct net_device *dev, | ||
| 271 | struct ethtool_perm_addr *addr, u8 *data); | ||
| 264 | 272 | ||
| 265 | /** | 273 | /** |
| 266 | * ðtool_ops - Alter and report network device settings | 274 | * ðtool_ops - Alter and report network device settings |
| @@ -294,7 +302,8 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data); | |||
| 294 | * get_strings: Return a set of strings that describe the requested objects | 302 | * get_strings: Return a set of strings that describe the requested objects |
| 295 | * phys_id: Identify the device | 303 | * phys_id: Identify the device |
| 296 | * get_stats: Return statistics about the device | 304 | * get_stats: Return statistics about the device |
| 297 | * | 305 | * get_perm_addr: Gets the permanent hardware address |
| 306 | * | ||
| 298 | * Description: | 307 | * Description: |
| 299 | * | 308 | * |
| 300 | * get_settings: | 309 | * get_settings: |
| @@ -352,6 +361,7 @@ struct ethtool_ops { | |||
| 352 | int (*phys_id)(struct net_device *, u32); | 361 | int (*phys_id)(struct net_device *, u32); |
| 353 | int (*get_stats_count)(struct net_device *); | 362 | int (*get_stats_count)(struct net_device *); |
| 354 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); | 363 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); |
| 364 | int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *); | ||
| 355 | int (*begin)(struct net_device *); | 365 | int (*begin)(struct net_device *); |
| 356 | void (*complete)(struct net_device *); | 366 | void (*complete)(struct net_device *); |
| 357 | }; | 367 | }; |
| @@ -389,6 +399,7 @@ struct ethtool_ops { | |||
| 389 | #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ | 399 | #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ |
| 390 | #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ | 400 | #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ |
| 391 | #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ | 401 | #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ |
| 402 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ | ||
| 392 | 403 | ||
| 393 | /* compatibility with older code */ | 404 | /* compatibility with older code */ |
| 394 | #define SPARC_ETH_GSET ETHTOOL_GSET | 405 | #define SPARC_ETH_GSET ETHTOOL_GSET |
| @@ -408,6 +419,8 @@ struct ethtool_ops { | |||
| 408 | #define SUPPORTED_FIBRE (1 << 10) | 419 | #define SUPPORTED_FIBRE (1 << 10) |
| 409 | #define SUPPORTED_BNC (1 << 11) | 420 | #define SUPPORTED_BNC (1 << 11) |
| 410 | #define SUPPORTED_10000baseT_Full (1 << 12) | 421 | #define SUPPORTED_10000baseT_Full (1 << 12) |
| 422 | #define SUPPORTED_Pause (1 << 13) | ||
| 423 | #define SUPPORTED_Asym_Pause (1 << 14) | ||
| 411 | 424 | ||
| 412 | /* Indicates what features are advertised by the interface. */ | 425 | /* Indicates what features are advertised by the interface. */ |
| 413 | #define ADVERTISED_10baseT_Half (1 << 0) | 426 | #define ADVERTISED_10baseT_Half (1 << 0) |
| @@ -423,6 +436,8 @@ struct ethtool_ops { | |||
| 423 | #define ADVERTISED_FIBRE (1 << 10) | 436 | #define ADVERTISED_FIBRE (1 << 10) |
| 424 | #define ADVERTISED_BNC (1 << 11) | 437 | #define ADVERTISED_BNC (1 << 11) |
| 425 | #define ADVERTISED_10000baseT_Full (1 << 12) | 438 | #define ADVERTISED_10000baseT_Full (1 << 12) |
| 439 | #define ADVERTISED_Pause (1 << 13) | ||
| 440 | #define ADVERTISED_Asym_Pause (1 << 14) | ||
| 426 | 441 | ||
| 427 | /* The following are all involved in forcing a particular link | 442 | /* The following are all involved in forcing a particular link |
| 428 | * mode for the device for setting things. When getting the | 443 | * mode for the device for setting things. When getting the |
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 302ec20838ca..67e6732d4fdc 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 | ||
| @@ -692,11 +697,13 @@ extern struct list_head file_lock_list; | |||
| 692 | #include <linux/fcntl.h> | 697 | #include <linux/fcntl.h> |
| 693 | 698 | ||
| 694 | extern int fcntl_getlk(struct file *, struct flock __user *); | 699 | extern int fcntl_getlk(struct file *, struct flock __user *); |
| 695 | extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); | 700 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
| 701 | struct flock __user *); | ||
| 696 | 702 | ||
| 697 | #if BITS_PER_LONG == 32 | 703 | #if BITS_PER_LONG == 32 |
| 698 | extern int fcntl_getlk64(struct file *, struct flock64 __user *); | 704 | extern int fcntl_getlk64(struct file *, struct flock64 __user *); |
| 699 | extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *); | 705 | extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, |
| 706 | struct flock64 __user *); | ||
| 700 | #endif | 707 | #endif |
| 701 | 708 | ||
| 702 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 709 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
| @@ -986,8 +993,8 @@ struct inode_operations { | |||
| 986 | int (*rename) (struct inode *, struct dentry *, | 993 | int (*rename) (struct inode *, struct dentry *, |
| 987 | struct inode *, struct dentry *); | 994 | struct inode *, struct dentry *); |
| 988 | int (*readlink) (struct dentry *, char __user *,int); | 995 | int (*readlink) (struct dentry *, char __user *,int); |
| 989 | int (*follow_link) (struct dentry *, struct nameidata *); | 996 | void * (*follow_link) (struct dentry *, struct nameidata *); |
| 990 | void (*put_link) (struct dentry *, struct nameidata *); | 997 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
| 991 | void (*truncate) (struct inode *); | 998 | void (*truncate) (struct inode *); |
| 992 | int (*permission) (struct inode *, int, struct nameidata *); | 999 | int (*permission) (struct inode *, int, struct nameidata *); |
| 993 | int (*setattr) (struct dentry *, struct iattr *); | 1000 | int (*setattr) (struct dentry *, struct iattr *); |
| @@ -1393,7 +1400,6 @@ extern void emergency_remount(void); | |||
| 1393 | extern int do_remount_sb(struct super_block *sb, int flags, | 1400 | extern int do_remount_sb(struct super_block *sb, int flags, |
| 1394 | void *data, int force); | 1401 | void *data, int force); |
| 1395 | extern sector_t bmap(struct inode *, sector_t); | 1402 | extern sector_t bmap(struct inode *, sector_t); |
| 1396 | extern int setattr_mask(unsigned int); | ||
| 1397 | extern int notify_change(struct dentry *, struct iattr *); | 1403 | extern int notify_change(struct dentry *, struct iattr *); |
| 1398 | extern int permission(struct inode *, int, struct nameidata *); | 1404 | extern int permission(struct inode *, int, struct nameidata *); |
| 1399 | extern int generic_permission(struct inode *, int, | 1405 | extern int generic_permission(struct inode *, int, |
| @@ -1437,6 +1443,9 @@ extern int inode_needs_sync(struct inode *inode); | |||
| 1437 | extern void generic_delete_inode(struct inode *inode); | 1443 | extern void generic_delete_inode(struct inode *inode); |
| 1438 | extern void generic_drop_inode(struct inode *inode); | 1444 | extern void generic_drop_inode(struct inode *inode); |
| 1439 | 1445 | ||
| 1446 | extern struct inode *ilookup5_nowait(struct super_block *sb, | ||
| 1447 | unsigned long hashval, int (*test)(struct inode *, void *), | ||
| 1448 | void *data); | ||
| 1440 | extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, | 1449 | extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, |
| 1441 | int (*test)(struct inode *, void *), void *data); | 1450 | int (*test)(struct inode *, void *), void *data); |
| 1442 | extern struct inode *ilookup(struct super_block *sb, unsigned long ino); | 1451 | extern struct inode *ilookup(struct super_block *sb, unsigned long ino); |
| @@ -1593,8 +1602,8 @@ extern struct file_operations generic_ro_fops; | |||
| 1593 | extern int vfs_readlink(struct dentry *, char __user *, int, const char *); | 1602 | extern int vfs_readlink(struct dentry *, char __user *, int, const char *); |
| 1594 | extern int vfs_follow_link(struct nameidata *, const char *); | 1603 | extern int vfs_follow_link(struct nameidata *, const char *); |
| 1595 | extern int page_readlink(struct dentry *, char __user *, int); | 1604 | extern int page_readlink(struct dentry *, char __user *, int); |
| 1596 | extern int page_follow_link_light(struct dentry *, struct nameidata *); | 1605 | extern void *page_follow_link_light(struct dentry *, struct nameidata *); |
| 1597 | extern void page_put_link(struct dentry *, struct nameidata *); | 1606 | extern void page_put_link(struct dentry *, struct nameidata *, void *); |
| 1598 | extern int page_symlink(struct inode *inode, const char *symname, int len); | 1607 | extern int page_symlink(struct inode *inode, const char *symname, int len); |
| 1599 | extern struct inode_operations page_symlink_inode_operations; | 1608 | extern struct inode_operations page_symlink_inode_operations; |
| 1600 | extern int generic_readlink(struct dentry *, char __user *, int); | 1609 | extern int generic_readlink(struct dentry *, char __user *, int); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h new file mode 100644 index 000000000000..03b8e7932b83 --- /dev/null +++ b/include/linux/fsnotify.h | |||
| @@ -0,0 +1,251 @@ | |||
| 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, struct inode *target, struct inode *source) | ||
| 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 | if (target) { | ||
| 41 | inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); | ||
| 42 | inotify_inode_is_dead(target); | ||
| 43 | } | ||
| 44 | |||
| 45 | if (source) { | ||
| 46 | inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | /* | ||
| 51 | * fsnotify_nameremove - a filename was removed from a directory | ||
| 52 | */ | ||
| 53 | static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | ||
| 54 | { | ||
| 55 | if (isdir) | ||
| 56 | isdir = IN_ISDIR; | ||
| 57 | dnotify_parent(dentry, DN_DELETE); | ||
| 58 | inotify_dentry_parent_queue_event(dentry, IN_DELETE|isdir, 0, dentry->d_name.name); | ||
| 59 | } | ||
| 60 | |||
| 61 | /* | ||
| 62 | * fsnotify_inoderemove - an inode is going away | ||
| 63 | */ | ||
| 64 | static inline void fsnotify_inoderemove(struct inode *inode) | ||
| 65 | { | ||
| 66 | inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); | ||
| 67 | inotify_inode_is_dead(inode); | ||
| 68 | } | ||
| 69 | |||
| 70 | /* | ||
| 71 | * fsnotify_create - 'name' was linked in | ||
| 72 | */ | ||
| 73 | static inline void fsnotify_create(struct inode *inode, const char *name) | ||
| 74 | { | ||
| 75 | inode_dir_notify(inode, DN_CREATE); | ||
| 76 | inotify_inode_queue_event(inode, IN_CREATE, 0, name); | ||
| 77 | } | ||
| 78 | |||
| 79 | /* | ||
| 80 | * fsnotify_mkdir - directory 'name' was created | ||
| 81 | */ | ||
| 82 | static inline void fsnotify_mkdir(struct inode *inode, const char *name) | ||
| 83 | { | ||
| 84 | inode_dir_notify(inode, DN_CREATE); | ||
| 85 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); | ||
| 86 | } | ||
| 87 | |||
| 88 | /* | ||
| 89 | * fsnotify_access - file was read | ||
| 90 | */ | ||
| 91 | static inline void fsnotify_access(struct dentry *dentry) | ||
| 92 | { | ||
| 93 | struct inode *inode = dentry->d_inode; | ||
| 94 | u32 mask = IN_ACCESS; | ||
| 95 | |||
| 96 | if (S_ISDIR(inode->i_mode)) | ||
| 97 | mask |= IN_ISDIR; | ||
| 98 | |||
| 99 | dnotify_parent(dentry, DN_ACCESS); | ||
| 100 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 101 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 102 | } | ||
| 103 | |||
| 104 | /* | ||
| 105 | * fsnotify_modify - file was modified | ||
| 106 | */ | ||
| 107 | static inline void fsnotify_modify(struct dentry *dentry) | ||
| 108 | { | ||
| 109 | struct inode *inode = dentry->d_inode; | ||
| 110 | u32 mask = IN_MODIFY; | ||
| 111 | |||
| 112 | if (S_ISDIR(inode->i_mode)) | ||
| 113 | mask |= IN_ISDIR; | ||
| 114 | |||
| 115 | dnotify_parent(dentry, DN_MODIFY); | ||
| 116 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 117 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 118 | } | ||
| 119 | |||
| 120 | /* | ||
| 121 | * fsnotify_open - file was opened | ||
| 122 | */ | ||
| 123 | static inline void fsnotify_open(struct dentry *dentry) | ||
| 124 | { | ||
| 125 | struct inode *inode = dentry->d_inode; | ||
| 126 | u32 mask = IN_OPEN; | ||
| 127 | |||
| 128 | if (S_ISDIR(inode->i_mode)) | ||
| 129 | mask |= IN_ISDIR; | ||
| 130 | |||
| 131 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 132 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 133 | } | ||
| 134 | |||
| 135 | /* | ||
| 136 | * fsnotify_close - file was closed | ||
| 137 | */ | ||
| 138 | static inline void fsnotify_close(struct file *file) | ||
| 139 | { | ||
| 140 | struct dentry *dentry = file->f_dentry; | ||
| 141 | struct inode *inode = dentry->d_inode; | ||
| 142 | const char *name = dentry->d_name.name; | ||
| 143 | mode_t mode = file->f_mode; | ||
| 144 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; | ||
| 145 | |||
| 146 | if (S_ISDIR(inode->i_mode)) | ||
| 147 | mask |= IN_ISDIR; | ||
| 148 | |||
| 149 | inotify_dentry_parent_queue_event(dentry, mask, 0, name); | ||
| 150 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 151 | } | ||
| 152 | |||
| 153 | /* | ||
| 154 | * fsnotify_xattr - extended attributes were changed | ||
| 155 | */ | ||
| 156 | static inline void fsnotify_xattr(struct dentry *dentry) | ||
| 157 | { | ||
| 158 | struct inode *inode = dentry->d_inode; | ||
| 159 | u32 mask = IN_ATTRIB; | ||
| 160 | |||
| 161 | if (S_ISDIR(inode->i_mode)) | ||
| 162 | mask |= IN_ISDIR; | ||
| 163 | |||
| 164 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | ||
| 165 | inotify_inode_queue_event(inode, mask, 0, NULL); | ||
| 166 | } | ||
| 167 | |||
| 168 | /* | ||
| 169 | * fsnotify_change - notify_change event. file was modified and/or metadata | ||
| 170 | * was changed. | ||
| 171 | */ | ||
| 172 | static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) | ||
| 173 | { | ||
| 174 | struct inode *inode = dentry->d_inode; | ||
| 175 | int dn_mask = 0; | ||
| 176 | u32 in_mask = 0; | ||
| 177 | |||
| 178 | if (ia_valid & ATTR_UID) { | ||
| 179 | in_mask |= IN_ATTRIB; | ||
| 180 | dn_mask |= DN_ATTRIB; | ||
| 181 | } | ||
| 182 | if (ia_valid & ATTR_GID) { | ||
| 183 | in_mask |= IN_ATTRIB; | ||
| 184 | dn_mask |= DN_ATTRIB; | ||
| 185 | } | ||
| 186 | if (ia_valid & ATTR_SIZE) { | ||
| 187 | in_mask |= IN_MODIFY; | ||
| 188 | dn_mask |= DN_MODIFY; | ||
| 189 | } | ||
| 190 | /* both times implies a utime(s) call */ | ||
| 191 | if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) | ||
| 192 | { | ||
| 193 | in_mask |= IN_ATTRIB; | ||
| 194 | dn_mask |= DN_ATTRIB; | ||
| 195 | } else if (ia_valid & ATTR_ATIME) { | ||
| 196 | in_mask |= IN_ACCESS; | ||
| 197 | dn_mask |= DN_ACCESS; | ||
| 198 | } else if (ia_valid & ATTR_MTIME) { | ||
| 199 | in_mask |= IN_MODIFY; | ||
| 200 | dn_mask |= DN_MODIFY; | ||
| 201 | } | ||
| 202 | if (ia_valid & ATTR_MODE) { | ||
| 203 | in_mask |= IN_ATTRIB; | ||
| 204 | dn_mask |= DN_ATTRIB; | ||
| 205 | } | ||
| 206 | |||
| 207 | if (dn_mask) | ||
| 208 | dnotify_parent(dentry, dn_mask); | ||
| 209 | if (in_mask) { | ||
| 210 | if (S_ISDIR(inode->i_mode)) | ||
| 211 | in_mask |= IN_ISDIR; | ||
| 212 | inotify_inode_queue_event(inode, in_mask, 0, NULL); | ||
| 213 | inotify_dentry_parent_queue_event(dentry, in_mask, 0, | ||
| 214 | dentry->d_name.name); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 218 | #ifdef CONFIG_INOTIFY /* inotify helpers */ | ||
| 219 | |||
| 220 | /* | ||
| 221 | * fsnotify_oldname_init - save off the old filename before we change it | ||
| 222 | */ | ||
| 223 | static inline const char *fsnotify_oldname_init(const char *name) | ||
| 224 | { | ||
| 225 | return kstrdup(name, GFP_KERNEL); | ||
| 226 | } | ||
| 227 | |||
| 228 | /* | ||
| 229 | * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init | ||
| 230 | */ | ||
| 231 | static inline void fsnotify_oldname_free(const char *old_name) | ||
| 232 | { | ||
| 233 | kfree(old_name); | ||
| 234 | } | ||
| 235 | |||
| 236 | #else /* CONFIG_INOTIFY */ | ||
| 237 | |||
| 238 | static inline const char *fsnotify_oldname_init(const char *name) | ||
| 239 | { | ||
| 240 | return NULL; | ||
| 241 | } | ||
| 242 | |||
| 243 | static inline void fsnotify_oldname_free(const char *old_name) | ||
| 244 | { | ||
| 245 | } | ||
| 246 | |||
| 247 | #endif /* ! CONFIG_INOTIFY */ | ||
| 248 | |||
| 249 | #endif /* __KERNEL__ */ | ||
| 250 | |||
| 251 | #endif /* _LINUX_FS_NOTIFY_H */ | ||
diff --git a/include/linux/ftape.h b/include/linux/ftape.h index c6b38d5b9186..72faeec9f6e1 100644 --- a/include/linux/ftape.h +++ b/include/linux/ftape.h | |||
| @@ -165,7 +165,7 @@ typedef union { | |||
| 165 | # undef CONFIG_FT_FDC_DMA | 165 | # undef CONFIG_FT_FDC_DMA |
| 166 | # define CONFIG_FT_FDC_DMA 2 | 166 | # define CONFIG_FT_FDC_DMA 2 |
| 167 | # endif | 167 | # endif |
| 168 | #elif CONFIG_FT_ALT_FDC == 1 /* CONFIG_FT_MACH2 */ | 168 | #elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */ |
| 169 | # if CONFIG_FT_FDC_BASE == 0 | 169 | # if CONFIG_FT_FDC_BASE == 0 |
| 170 | # undef CONFIG_FT_FDC_BASE | 170 | # undef CONFIG_FT_FDC_BASE |
| 171 | # define CONFIG_FT_FDC_BASE 0x370 | 171 | # define CONFIG_FT_FDC_BASE 0x370 |
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/hippidevice.h b/include/linux/hippidevice.h index 9debe6bbe5f0..bab303dafd6e 100644 --- a/include/linux/hippidevice.h +++ b/include/linux/hippidevice.h | |||
| @@ -26,8 +26,12 @@ | |||
| 26 | #include <linux/if_hippi.h> | 26 | #include <linux/if_hippi.h> |
| 27 | 27 | ||
| 28 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
| 29 | extern unsigned short hippi_type_trans(struct sk_buff *skb, | 29 | |
| 30 | struct net_device *dev); | 30 | struct hippi_cb { |
| 31 | __u32 ifield; | ||
| 32 | }; | ||
| 33 | |||
| 34 | extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); | ||
| 31 | 35 | ||
| 32 | extern struct net_device *alloc_hippi_dev(int sizeof_priv); | 36 | extern struct net_device *alloc_hippi_dev(int sizeof_priv); |
| 33 | #endif | 37 | #endif |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f529d1442815..e670b0d13fe0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -70,12 +70,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
| 70 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | 70 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE | ||
| 74 | #define hugetlb_clean_stale_pgtable(pte) BUG() | ||
| 75 | #else | ||
| 76 | void hugetlb_clean_stale_pgtable(pte_t *pte); | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #else /* !CONFIG_HUGETLB_PAGE */ | 73 | #else /* !CONFIG_HUGETLB_PAGE */ |
| 80 | 74 | ||
| 81 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 75 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h index 1b5018a965f5..7eb4004b3601 100644 --- a/include/linux/hwmon-sysfs.h +++ b/include/linux/hwmon-sysfs.h | |||
| @@ -33,4 +33,19 @@ struct sensor_device_attribute sensor_dev_attr_##_name = { \ | |||
| 33 | .index = _index, \ | 33 | .index = _index, \ |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | struct sensor_device_attribute_2 { | ||
| 37 | struct device_attribute dev_attr; | ||
| 38 | u8 index; | ||
| 39 | u8 nr; | ||
| 40 | }; | ||
| 41 | #define to_sensor_dev_attr_2(_dev_attr) \ | ||
| 42 | container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr) | ||
| 43 | |||
| 44 | #define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \ | ||
| 45 | struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \ | ||
| 46 | .dev_attr = __ATTR(_name,_mode,_show,_store), \ | ||
| 47 | .index = _index, \ | ||
| 48 | .nr = _nr, \ | ||
| 49 | } | ||
| 50 | |||
| 36 | #endif /* _LINUX_HWMON_SYSFS_H */ | 51 | #endif /* _LINUX_HWMON_SYSFS_H */ |
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h new file mode 100644 index 000000000000..cd4b7a042b86 --- /dev/null +++ b/include/linux/hwmon-vid.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | hwmon-vid.h - VID/VRM/VRD voltage conversions | ||
| 3 | |||
| 4 | Originally part of lm_sensors | ||
| 5 | Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | ||
| 6 | With assistance from Trent Piepho <xyzzy@speakeasy.org> | ||
| 7 | |||
| 8 | This program is free software; you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation; either version 2 of the License, or | ||
| 11 | (at your option) any later version. | ||
| 12 | |||
| 13 | This program is distributed in the hope that it will be useful, | ||
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | GNU General Public License for more details. | ||
| 17 | |||
| 18 | You should have received a copy of the GNU General Public License | ||
| 19 | along with this program; if not, write to the Free Software | ||
| 20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef _LINUX_HWMON_VID_H | ||
| 24 | #define _LINUX_HWMON_VID_H | ||
| 25 | |||
| 26 | int vid_from_reg(int val, int vrm); | ||
| 27 | int vid_which_vrm(void); | ||
| 28 | |||
| 29 | /* vrm is the VRM/VRD document version multiplied by 10. | ||
| 30 | val is in mV to avoid floating point in the kernel. | ||
| 31 | Returned value is the 4-, 5- or 6-bit VID code. | ||
| 32 | Note that only VRM 9.x is supported for now. */ | ||
| 33 | static inline int vid_to_reg(int val, int vrm) | ||
| 34 | { | ||
| 35 | switch (vrm) { | ||
| 36 | case 91: /* VRM 9.1 */ | ||
| 37 | case 90: /* VRM 9.0 */ | ||
| 38 | return ((val >= 1100) && (val <= 1850) ? | ||
| 39 | ((18499 - val * 10) / 25 + 5) / 10 : -1); | ||
| 40 | default: | ||
| 41 | return -1; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | #endif /* _LINUX_HWMON_VID_H */ | ||
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h new file mode 100644 index 000000000000..0efd994c37f1 --- /dev/null +++ b/include/linux/hwmon.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring | ||
| 3 | |||
| 4 | This file declares helper functions for the sysfs class "hwmon", | ||
| 5 | for use by sensors drivers. | ||
| 6 | |||
| 7 | Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com> | ||
| 8 | |||
| 9 | This program is free software; you can redistribute it and/or modify | ||
| 10 | it under the terms of the GNU General Public License as published by | ||
| 11 | the Free Software Foundation; version 2 of the License. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef _HWMON_H_ | ||
| 15 | #define _HWMON_H_ | ||
| 16 | |||
| 17 | #include <linux/device.h> | ||
| 18 | |||
| 19 | struct class_device *hwmon_device_register(struct device *dev); | ||
| 20 | |||
| 21 | void hwmon_device_unregister(struct class_device *cdev); | ||
| 22 | |||
| 23 | /* Scale user input to sensible values */ | ||
| 24 | static inline int SENSORS_LIMIT(long value, long low, long high) | ||
| 25 | { | ||
| 26 | if (value < low) | ||
| 27 | return low; | ||
| 28 | else if (value > high) | ||
| 29 | return high; | ||
| 30 | else | ||
| 31 | return value; | ||
| 32 | } | ||
| 33 | |||
| 34 | #endif | ||
| 35 | |||
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 33f08258f22b..44f30876a1c9 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
| 2 | /* */ | 2 | /* */ |
| 3 | /* i2c.h - definitions for the i2c-bus interface */ | 3 | /* i2c-id.h - identifier values for i2c drivers and adapters */ |
| 4 | /* */ | 4 | /* */ |
| 5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
| 6 | /* Copyright (C) 1995-1999 Simon G. Vogl | 6 | /* Copyright (C) 1995-1999 Simon G. Vogl |
| @@ -24,16 +24,6 @@ | |||
| 24 | #define LINUX_I2C_ID_H | 24 | #define LINUX_I2C_ID_H |
| 25 | 25 | ||
| 26 | /* | 26 | /* |
| 27 | * This file is part of the i2c-bus package and contains the identifier | ||
| 28 | * values for drivers, adapters and other folk populating these serial | ||
| 29 | * worlds. | ||
| 30 | * | ||
| 31 | * These will change often (i.e. additions) , therefore this has been | ||
| 32 | * separated from the functional interface definitions of the i2c api. | ||
| 33 | * | ||
| 34 | */ | ||
| 35 | |||
| 36 | /* | ||
| 37 | * ---- Driver types ----------------------------------------------------- | 27 | * ---- Driver types ----------------------------------------------------- |
| 38 | * device id name + number function description, i2c address(es) | 28 | * device id name + number function description, i2c address(es) |
| 39 | * | 29 | * |
| @@ -170,151 +160,113 @@ | |||
| 170 | 160 | ||
| 171 | /* | 161 | /* |
| 172 | * ---- Adapter types ---------------------------------------------------- | 162 | * ---- Adapter types ---------------------------------------------------- |
| 173 | * | ||
| 174 | * First, we distinguish between several algorithms to access the hardware | ||
| 175 | * interface types, as a PCF 8584 needs other care than a bit adapter. | ||
| 176 | */ | ||
| 177 | |||
| 178 | #define I2C_ALGO_NONE 0x000000 | ||
| 179 | #define I2C_ALGO_BIT 0x010000 /* bit style adapters */ | ||
| 180 | #define I2C_ALGO_PCF 0x020000 /* PCF 8584 style adapters */ | ||
| 181 | #define I2C_ALGO_ATI 0x030000 /* ATI video card */ | ||
| 182 | #define I2C_ALGO_SMBUS 0x040000 | ||
| 183 | #define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */ | ||
| 184 | #define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */ | ||
| 185 | #define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */ | ||
| 186 | #define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */ | ||
| 187 | #define I2C_ALGO_SAA7134 0x090000 | ||
| 188 | #define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */ | ||
| 189 | #define I2C_ALGO_IPMI 0x0b0000 /* IPMI dummy adapter */ | ||
| 190 | #define I2C_ALGO_IPMB 0x0c0000 /* IPMB adapter */ | ||
| 191 | #define I2C_ALGO_MPC107 0x0d0000 | ||
| 192 | #define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */ | ||
| 193 | |||
| 194 | #define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ | ||
| 195 | #define I2C_ALGO_OCP 0x120000 /* IBM or otherwise On-chip I2C algorithm */ | ||
| 196 | #define I2C_ALGO_BITHS 0x130000 /* enhanced bit style adapters */ | ||
| 197 | #define I2C_ALGO_IOP3XX 0x140000 /* XSCALE IOP3XX On-chip I2C alg */ | ||
| 198 | #define I2C_ALGO_SIBYTE 0x150000 /* Broadcom SiByte SOCs */ | ||
| 199 | #define I2C_ALGO_SGI 0x160000 /* SGI algorithm */ | ||
| 200 | |||
| 201 | #define I2C_ALGO_USB 0x170000 /* USB algorithm */ | ||
| 202 | #define I2C_ALGO_VIRT 0x180000 /* Virtual bus adapter */ | ||
| 203 | |||
| 204 | #define I2C_ALGO_MV64XXX 0x190000 /* Marvell mv64xxx i2c ctlr */ | ||
| 205 | #define I2C_ALGO_PCA 0x1a0000 /* PCA 9564 style adapters */ | ||
| 206 | #define I2C_ALGO_AU1550 0x1b0000 /* Au1550 PSC algorithm */ | ||
| 207 | |||
| 208 | #define I2C_ALGO_EXP 0x800000 /* experimental */ | ||
| 209 | |||
| 210 | #define I2C_ALGO_MASK 0xff0000 /* Mask for algorithms */ | ||
| 211 | #define I2C_ALGO_SHIFT 0x10 /* right shift to get index values */ | ||
| 212 | |||
| 213 | #define I2C_HW_ADAPS 0x10000 /* # adapter types */ | ||
| 214 | #define I2C_HW_MASK 0xffff | ||
| 215 | |||
| 216 | |||
| 217 | /* hw specific modules that are defined per algorithm layer | ||
| 218 | */ | 163 | */ |
| 219 | 164 | ||
| 220 | /* --- Bit algorithm adapters */ | 165 | /* --- Bit algorithm adapters */ |
| 221 | #define I2C_HW_B_LP 0x00 /* Parallel port Philips style adapter */ | 166 | #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ |
| 222 | #define I2C_HW_B_LPC 0x01 /* Parallel port, over control reg. */ | 167 | #define I2C_HW_B_LPC 0x010001 /* Parallel port control reg. */ |
| 223 | #define I2C_HW_B_SER 0x02 /* Serial line interface */ | 168 | #define I2C_HW_B_SER 0x010002 /* Serial line interface */ |
| 224 | #define I2C_HW_B_ELV 0x03 /* ELV Card */ | 169 | #define I2C_HW_B_ELV 0x010003 /* ELV Card */ |
| 225 | #define I2C_HW_B_VELLE 0x04 /* Vellemann K8000 */ | 170 | #define I2C_HW_B_VELLE 0x010004 /* Vellemann K8000 */ |
| 226 | #define I2C_HW_B_BT848 0x05 /* BT848 video boards */ | 171 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ |
| 227 | #define I2C_HW_B_WNV 0x06 /* Winnov Videums */ | 172 | #define I2C_HW_B_WNV 0x010006 /* Winnov Videums */ |
| 228 | #define I2C_HW_B_VIA 0x07 /* Via vt82c586b */ | 173 | #define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ |
| 229 | #define I2C_HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */ | 174 | #define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ |
| 230 | #define I2C_HW_B_G400 0x09 /* Matrox G400 */ | 175 | #define I2C_HW_B_G400 0x010009 /* Matrox G400 */ |
| 231 | #define I2C_HW_B_I810 0x0a /* Intel I810 */ | 176 | #define I2C_HW_B_I810 0x01000a /* Intel I810 */ |
| 232 | #define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */ | 177 | #define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ |
| 233 | #define I2C_HW_B_PPORT 0x0c /* Primitive parallel port adapter */ | 178 | #define I2C_HW_B_PPORT 0x01000c /* Primitive parallel port adapter */ |
| 234 | #define I2C_HW_B_SAVG 0x0d /* Savage 4 */ | 179 | #define I2C_HW_B_SAVG 0x01000d /* Savage 4 */ |
| 235 | #define I2C_HW_B_SCX200 0x0e /* Nat'l Semi SCx200 I2C */ | 180 | #define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ |
| 236 | #define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */ | 181 | #define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ |
| 237 | #define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */ | 182 | #define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ |
| 238 | #define I2C_HW_B_TSUNA 0x12 /* DEC Tsunami chipset */ | 183 | #define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */ |
| 239 | #define I2C_HW_B_FRODO 0x13 /* 2d3D, Inc. SA-1110 Development Board */ | 184 | #define I2C_HW_B_FRODO 0x010013 /* 2d3D SA-1110 Development Board */ |
| 240 | #define I2C_HW_B_OMAHA 0x14 /* Omaha I2C interface (ARM) */ | 185 | #define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */ |
| 241 | #define I2C_HW_B_GUIDE 0x15 /* Guide bit-basher */ | 186 | #define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */ |
| 242 | #define I2C_HW_B_IXP2000 0x16 /* GPIO on IXP2000 systems */ | 187 | #define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ |
| 243 | #define I2C_HW_B_IXP4XX 0x17 /* GPIO on IXP4XX systems */ | 188 | #define I2C_HW_B_IXP4XX 0x010017 /* GPIO on IXP4XX systems */ |
| 244 | #define I2C_HW_B_S3VIA 0x18 /* S3Via ProSavage adapter */ | 189 | #define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */ |
| 245 | #define I2C_HW_B_ZR36067 0x19 /* Zoran-36057/36067 based boards */ | 190 | #define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ |
| 246 | #define I2C_HW_B_PCILYNX 0x1a /* TI PCILynx I2C adapter */ | 191 | #define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ |
| 247 | #define I2C_HW_B_CX2388x 0x1b /* connexant 2388x based tv cards */ | 192 | #define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ |
| 193 | #define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */ | ||
| 194 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ | ||
| 195 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ | ||
| 248 | 196 | ||
| 249 | /* --- PCF 8584 based algorithms */ | 197 | /* --- PCF 8584 based algorithms */ |
| 250 | #define I2C_HW_P_LP 0x00 /* Parallel port interface */ | 198 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ |
| 251 | #define I2C_HW_P_ISA 0x01 /* generic ISA Bus inteface card */ | 199 | #define I2C_HW_P_ISA 0x020001 /* generic ISA Bus inteface card */ |
| 252 | #define I2C_HW_P_ELEK 0x02 /* Elektor ISA Bus inteface card */ | 200 | #define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */ |
| 253 | 201 | ||
| 254 | /* --- PCA 9564 based algorithms */ | 202 | /* --- PCA 9564 based algorithms */ |
| 255 | #define I2C_HW_A_ISA 0x00 /* generic ISA Bus interface card */ | 203 | #define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */ |
| 256 | 204 | ||
| 257 | /* --- ACPI Embedded controller algorithms */ | 205 | /* --- ACPI Embedded controller algorithms */ |
| 258 | #define I2C_HW_ACPI_EC 0x00 | 206 | #define I2C_HW_ACPI_EC 0x1f0000 |
| 259 | 207 | ||
| 260 | /* --- MPC824x PowerPC adapters */ | 208 | /* --- MPC824x PowerPC adapters */ |
| 261 | #define I2C_HW_MPC824X 0x00 /* Motorola 8240 / 8245 */ | 209 | #define I2C_HW_MPC824X 0x100001 /* Motorola 8240 / 8245 */ |
| 262 | 210 | ||
| 263 | /* --- MPC8xx PowerPC adapters */ | 211 | /* --- MPC8xx PowerPC adapters */ |
| 264 | #define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */ | 212 | #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ |
| 265 | 213 | ||
| 266 | /* --- ITE based algorithms */ | 214 | /* --- ITE based algorithms */ |
| 267 | #define I2C_HW_I_IIC 0x00 /* controller on the ITE */ | 215 | #define I2C_HW_I_IIC 0x080000 /* controller on the ITE */ |
| 268 | 216 | ||
| 269 | /* --- PowerPC on-chip adapters */ | 217 | /* --- PowerPC on-chip adapters */ |
| 270 | #define I2C_HW_OCP 0x00 /* IBM on-chip I2C adapter */ | 218 | #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ |
| 271 | 219 | ||
| 272 | /* --- Broadcom SiByte adapters */ | 220 | /* --- Broadcom SiByte adapters */ |
| 273 | #define I2C_HW_SIBYTE 0x00 | 221 | #define I2C_HW_SIBYTE 0x150000 |
| 274 | 222 | ||
| 275 | /* --- SGI adapters */ | 223 | /* --- SGI adapters */ |
| 276 | #define I2C_HW_SGI_VINO 0x00 | 224 | #define I2C_HW_SGI_VINO 0x160000 |
| 277 | #define I2C_HW_SGI_MACE 0x01 | 225 | #define I2C_HW_SGI_MACE 0x160001 |
| 278 | 226 | ||
| 279 | /* --- XSCALE on-chip adapters */ | 227 | /* --- XSCALE on-chip adapters */ |
| 280 | #define I2C_HW_IOP3XX 0x00 | 228 | #define I2C_HW_IOP3XX 0x140000 |
| 281 | 229 | ||
| 282 | /* --- Au1550 PSC adapters adapters */ | 230 | /* --- Au1550 PSC adapters adapters */ |
| 283 | #define I2C_HW_AU1550_PSC 0x00 | 231 | #define I2C_HW_AU1550_PSC 0x1b0000 |
| 284 | 232 | ||
| 285 | /* --- SMBus only adapters */ | 233 | /* --- SMBus only adapters */ |
| 286 | #define I2C_HW_SMBUS_PIIX4 0x00 | 234 | #define I2C_HW_SMBUS_PIIX4 0x040000 |
| 287 | #define I2C_HW_SMBUS_ALI15X3 0x01 | 235 | #define I2C_HW_SMBUS_ALI15X3 0x040001 |
| 288 | #define I2C_HW_SMBUS_VIA2 0x02 | 236 | #define I2C_HW_SMBUS_VIA2 0x040002 |
| 289 | #define I2C_HW_SMBUS_VOODOO3 0x03 | 237 | #define I2C_HW_SMBUS_VOODOO3 0x040003 |
| 290 | #define I2C_HW_SMBUS_I801 0x04 | 238 | #define I2C_HW_SMBUS_I801 0x040004 |
| 291 | #define I2C_HW_SMBUS_AMD756 0x05 | 239 | #define I2C_HW_SMBUS_AMD756 0x040005 |
| 292 | #define I2C_HW_SMBUS_SIS5595 0x06 | 240 | #define I2C_HW_SMBUS_SIS5595 0x040006 |
| 293 | #define I2C_HW_SMBUS_ALI1535 0x07 | 241 | #define I2C_HW_SMBUS_ALI1535 0x040007 |
| 294 | #define I2C_HW_SMBUS_SIS630 0x08 | 242 | #define I2C_HW_SMBUS_SIS630 0x040008 |
| 295 | #define I2C_HW_SMBUS_SIS96X 0x09 | 243 | #define I2C_HW_SMBUS_SIS96X 0x040009 |
| 296 | #define I2C_HW_SMBUS_AMD8111 0x0a | 244 | #define I2C_HW_SMBUS_AMD8111 0x04000a |
| 297 | #define I2C_HW_SMBUS_SCX200 0x0b | 245 | #define I2C_HW_SMBUS_SCX200 0x04000b |
| 298 | #define I2C_HW_SMBUS_NFORCE2 0x0c | 246 | #define I2C_HW_SMBUS_NFORCE2 0x04000c |
| 299 | #define I2C_HW_SMBUS_W9968CF 0x0d | 247 | #define I2C_HW_SMBUS_W9968CF 0x04000d |
| 300 | #define I2C_HW_SMBUS_OV511 0x0e /* OV511(+) USB 1.1 webcam ICs */ | 248 | #define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ |
| 301 | #define I2C_HW_SMBUS_OV518 0x0f /* OV518(+) USB 1.1 webcam ICs */ | 249 | #define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ |
| 302 | #define I2C_HW_SMBUS_OV519 0x10 /* OV519 USB 1.1 webcam IC */ | 250 | #define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */ |
| 303 | #define I2C_HW_SMBUS_OVFX2 0x11 /* Cypress/OmniVision FX2 webcam */ | 251 | #define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */ |
| 304 | 252 | ||
| 305 | /* --- ISA pseudo-adapter */ | 253 | /* --- ISA pseudo-adapter */ |
| 306 | #define I2C_HW_ISA 0x00 | 254 | #define I2C_HW_ISA 0x050000 |
| 307 | 255 | ||
| 308 | /* --- IPMI pseudo-adapter */ | 256 | /* --- IPMI pseudo-adapter */ |
| 309 | #define I2C_HW_IPMI 0x00 | 257 | #define I2C_HW_IPMI 0x0b0000 |
| 310 | 258 | ||
| 311 | /* --- IPMB adapter */ | 259 | /* --- IPMB adapter */ |
| 312 | #define I2C_HW_IPMB 0x00 | 260 | #define I2C_HW_IPMB 0x0c0000 |
| 313 | 261 | ||
| 314 | /* --- MCP107 adapter */ | 262 | /* --- MCP107 adapter */ |
| 315 | #define I2C_HW_MPC107 0x00 | 263 | #define I2C_HW_MPC107 0x0d0000 |
| 316 | 264 | ||
| 317 | /* --- Marvell mv64xxx i2c adapter */ | 265 | /* --- Marvell mv64xxx i2c adapter */ |
| 318 | #define I2C_HW_MV64XXX 0x00 | 266 | #define I2C_HW_MV64XXX 0x190000 |
| 267 | |||
| 268 | /* --- Miscellaneous adapters */ | ||
| 269 | #define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */ | ||
| 270 | #define I2C_HW_SAA7134 0x090000 /* SAA7134 video decoder bus */ | ||
| 319 | 271 | ||
| 320 | #endif /* LINUX_I2C_ID_H */ | 272 | #endif /* LINUX_I2C_ID_H */ |
diff --git a/include/linux/i2c-isa.h b/include/linux/i2c-isa.h new file mode 100644 index 000000000000..67e3598c4cec --- /dev/null +++ b/include/linux/i2c-isa.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | * i2c-isa.h - definitions for the i2c-isa pseudo-i2c-adapter interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _LINUX_I2C_ISA_H | ||
| 22 | #define _LINUX_I2C_ISA_H | ||
| 23 | |||
| 24 | #include <linux/i2c.h> | ||
| 25 | |||
| 26 | extern int i2c_isa_add_driver(struct i2c_driver *driver); | ||
| 27 | extern int i2c_isa_del_driver(struct i2c_driver *driver); | ||
| 28 | |||
| 29 | /* Detect whether we are on the isa bus. This is only useful to hybrid | ||
| 30 | (i2c+isa) drivers. */ | ||
| 31 | #define i2c_is_isa_adapter(adapptr) \ | ||
| 32 | ((adapptr)->id == I2C_HW_ISA) | ||
| 33 | #define i2c_is_isa_client(clientptr) \ | ||
| 34 | i2c_is_isa_adapter((clientptr)->adapter) | ||
| 35 | |||
| 36 | #endif /* _LINUX_I2C_ISA_H */ | ||
diff --git a/include/linux/i2c-sensor.h b/include/linux/i2c-sensor.h deleted file mode 100644 index 21b625204956..000000000000 --- a/include/linux/i2c-sensor.h +++ /dev/null | |||
| @@ -1,263 +0,0 @@ | |||
| 1 | /* | ||
| 2 | i2c-sensor.h - Part of the i2c package | ||
| 3 | was originally sensors.h - Part of lm_sensors, Linux kernel modules | ||
| 4 | for hardware monitoring | ||
| 5 | Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 2 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; if not, write to the Free Software | ||
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef _LINUX_I2C_SENSOR_H | ||
| 23 | #define _LINUX_I2C_SENSOR_H | ||
| 24 | |||
| 25 | /* A structure containing detect information. | ||
| 26 | Force variables overrule all other variables; they force a detection on | ||
| 27 | that place. If a specific chip is given, the module blindly assumes this | ||
| 28 | chip type is present; if a general force (kind == 0) is given, the module | ||
| 29 | will still try to figure out what type of chip is present. This is useful | ||
| 30 | if for some reasons the detect for SMBus or ISA address space filled | ||
| 31 | fails. | ||
| 32 | probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values. | ||
| 33 | A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for | ||
| 34 | the ISA bus, -1 for any I2C bus), the second is the address. | ||
| 35 | kind: The kind of chip. 0 equals any chip. | ||
| 36 | */ | ||
| 37 | struct i2c_force_data { | ||
| 38 | unsigned short *force; | ||
| 39 | unsigned short kind; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* A structure containing the detect information. | ||
| 43 | normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_ISA_END. | ||
| 44 | A list of I2C addresses which should normally be examined. | ||
| 45 | normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END. | ||
| 46 | A list of ISA addresses which should normally be examined. | ||
| 47 | probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values. | ||
| 48 | A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for | ||
| 49 | the ISA bus, -1 for any I2C bus), the second is the address. These | ||
| 50 | addresses are also probed, as if they were in the 'normal' list. | ||
| 51 | ignore: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values. | ||
| 52 | A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for | ||
| 53 | the ISA bus, -1 for any I2C bus), the second is the I2C address. These | ||
| 54 | addresses are never probed. This parameter overrules 'normal' and | ||
| 55 | 'probe', but not the 'force' lists. | ||
| 56 | force_data: insmod parameters. A list, ending with an element of which | ||
| 57 | the force field is NULL. | ||
| 58 | */ | ||
| 59 | struct i2c_address_data { | ||
| 60 | unsigned short *normal_i2c; | ||
| 61 | unsigned int *normal_isa; | ||
| 62 | unsigned short *probe; | ||
| 63 | unsigned short *ignore; | ||
| 64 | struct i2c_force_data *forces; | ||
| 65 | }; | ||
| 66 | |||
| 67 | #define SENSORS_MODULE_PARM_FORCE(name) \ | ||
| 68 | I2C_CLIENT_MODULE_PARM(force_ ## name, \ | ||
| 69 | "List of adapter,address pairs which are unquestionably" \ | ||
| 70 | " assumed to contain a `" # name "' chip") | ||
| 71 | |||
| 72 | |||
| 73 | /* This defines several insmod variables, and the addr_data structure */ | ||
| 74 | #define SENSORS_INSMOD \ | ||
| 75 | I2C_CLIENT_MODULE_PARM(probe, \ | ||
| 76 | "List of adapter,address pairs to scan additionally"); \ | ||
| 77 | I2C_CLIENT_MODULE_PARM(ignore, \ | ||
| 78 | "List of adapter,address pairs not to scan"); \ | ||
| 79 | static struct i2c_address_data addr_data = { \ | ||
| 80 | .normal_i2c = normal_i2c, \ | ||
| 81 | .normal_isa = normal_isa, \ | ||
| 82 | .probe = probe, \ | ||
| 83 | .ignore = ignore, \ | ||
| 84 | .forces = forces, \ | ||
| 85 | } | ||
| 86 | |||
| 87 | /* The following functions create an enum with the chip names as elements. | ||
| 88 | The first element of the enum is any_chip. These are the only macros | ||
| 89 | a module will want to use. */ | ||
| 90 | |||
| 91 | #define SENSORS_INSMOD_0 \ | ||
| 92 | enum chips { any_chip }; \ | ||
| 93 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 94 | "List of adapter,address pairs to boldly assume " \ | ||
| 95 | "to be present"); \ | ||
| 96 | static struct i2c_force_data forces[] = {{force,any_chip},{NULL}}; \ | ||
| 97 | SENSORS_INSMOD | ||
| 98 | |||
| 99 | #define SENSORS_INSMOD_1(chip1) \ | ||
| 100 | enum chips { any_chip, chip1 }; \ | ||
| 101 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 102 | "List of adapter,address pairs to boldly assume " \ | ||
| 103 | "to be present"); \ | ||
| 104 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 105 | static struct i2c_force_data forces[] = {{force,any_chip},\ | ||
| 106 | {force_ ## chip1,chip1}, \ | ||
| 107 | {NULL}}; \ | ||
| 108 | SENSORS_INSMOD | ||
| 109 | |||
| 110 | #define SENSORS_INSMOD_2(chip1,chip2) \ | ||
| 111 | enum chips { any_chip, chip1, chip2 }; \ | ||
| 112 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 113 | "List of adapter,address pairs to boldly assume " \ | ||
| 114 | "to be present"); \ | ||
| 115 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 116 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 117 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 118 | {force_ ## chip1,chip1}, \ | ||
| 119 | {force_ ## chip2,chip2}, \ | ||
| 120 | {NULL}}; \ | ||
| 121 | SENSORS_INSMOD | ||
| 122 | |||
| 123 | #define SENSORS_INSMOD_3(chip1,chip2,chip3) \ | ||
| 124 | enum chips { any_chip, chip1, chip2, chip3 }; \ | ||
| 125 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 126 | "List of adapter,address pairs to boldly assume " \ | ||
| 127 | "to be present"); \ | ||
| 128 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 129 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 130 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 131 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 132 | {force_ ## chip1,chip1}, \ | ||
| 133 | {force_ ## chip2,chip2}, \ | ||
| 134 | {force_ ## chip3,chip3}, \ | ||
| 135 | {NULL}}; \ | ||
| 136 | SENSORS_INSMOD | ||
| 137 | |||
| 138 | #define SENSORS_INSMOD_4(chip1,chip2,chip3,chip4) \ | ||
| 139 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | ||
| 140 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 141 | "List of adapter,address pairs to boldly assume " \ | ||
| 142 | "to be present"); \ | ||
| 143 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 144 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 145 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 146 | SENSORS_MODULE_PARM_FORCE(chip4); \ | ||
| 147 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 148 | {force_ ## chip1,chip1}, \ | ||
| 149 | {force_ ## chip2,chip2}, \ | ||
| 150 | {force_ ## chip3,chip3}, \ | ||
| 151 | {force_ ## chip4,chip4}, \ | ||
| 152 | {NULL}}; \ | ||
| 153 | SENSORS_INSMOD | ||
| 154 | |||
| 155 | #define SENSORS_INSMOD_5(chip1,chip2,chip3,chip4,chip5) \ | ||
| 156 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | ||
| 157 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 158 | "List of adapter,address pairs to boldly assume " \ | ||
| 159 | "to be present"); \ | ||
| 160 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 161 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 162 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 163 | SENSORS_MODULE_PARM_FORCE(chip4); \ | ||
| 164 | SENSORS_MODULE_PARM_FORCE(chip5); \ | ||
| 165 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 166 | {force_ ## chip1,chip1}, \ | ||
| 167 | {force_ ## chip2,chip2}, \ | ||
| 168 | {force_ ## chip3,chip3}, \ | ||
| 169 | {force_ ## chip4,chip4}, \ | ||
| 170 | {force_ ## chip5,chip5}, \ | ||
| 171 | {NULL}}; \ | ||
| 172 | SENSORS_INSMOD | ||
| 173 | |||
| 174 | #define SENSORS_INSMOD_6(chip1,chip2,chip3,chip4,chip5,chip6) \ | ||
| 175 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | ||
| 176 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 177 | "List of adapter,address pairs to boldly assume " \ | ||
| 178 | "to be present"); \ | ||
| 179 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 180 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 181 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 182 | SENSORS_MODULE_PARM_FORCE(chip4); \ | ||
| 183 | SENSORS_MODULE_PARM_FORCE(chip5); \ | ||
| 184 | SENSORS_MODULE_PARM_FORCE(chip6); \ | ||
| 185 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 186 | {force_ ## chip1,chip1}, \ | ||
| 187 | {force_ ## chip2,chip2}, \ | ||
| 188 | {force_ ## chip3,chip3}, \ | ||
| 189 | {force_ ## chip4,chip4}, \ | ||
| 190 | {force_ ## chip5,chip5}, \ | ||
| 191 | {force_ ## chip6,chip6}, \ | ||
| 192 | {NULL}}; \ | ||
| 193 | SENSORS_INSMOD | ||
| 194 | |||
| 195 | #define SENSORS_INSMOD_7(chip1,chip2,chip3,chip4,chip5,chip6,chip7) \ | ||
| 196 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7 }; \ | ||
| 197 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 198 | "List of adapter,address pairs to boldly assume " \ | ||
| 199 | "to be present"); \ | ||
| 200 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 201 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 202 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 203 | SENSORS_MODULE_PARM_FORCE(chip4); \ | ||
| 204 | SENSORS_MODULE_PARM_FORCE(chip5); \ | ||
| 205 | SENSORS_MODULE_PARM_FORCE(chip6); \ | ||
| 206 | SENSORS_MODULE_PARM_FORCE(chip7); \ | ||
| 207 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 208 | {force_ ## chip1,chip1}, \ | ||
| 209 | {force_ ## chip2,chip2}, \ | ||
| 210 | {force_ ## chip3,chip3}, \ | ||
| 211 | {force_ ## chip4,chip4}, \ | ||
| 212 | {force_ ## chip5,chip5}, \ | ||
| 213 | {force_ ## chip6,chip6}, \ | ||
| 214 | {force_ ## chip7,chip7}, \ | ||
| 215 | {NULL}}; \ | ||
| 216 | SENSORS_INSMOD | ||
| 217 | |||
| 218 | #define SENSORS_INSMOD_8(chip1,chip2,chip3,chip4,chip5,chip6,chip7,chip8) \ | ||
| 219 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8 }; \ | ||
| 220 | I2C_CLIENT_MODULE_PARM(force, \ | ||
| 221 | "List of adapter,address pairs to boldly assume " \ | ||
| 222 | "to be present"); \ | ||
| 223 | SENSORS_MODULE_PARM_FORCE(chip1); \ | ||
| 224 | SENSORS_MODULE_PARM_FORCE(chip2); \ | ||
| 225 | SENSORS_MODULE_PARM_FORCE(chip3); \ | ||
| 226 | SENSORS_MODULE_PARM_FORCE(chip4); \ | ||
| 227 | SENSORS_MODULE_PARM_FORCE(chip5); \ | ||
| 228 | SENSORS_MODULE_PARM_FORCE(chip6); \ | ||
| 229 | SENSORS_MODULE_PARM_FORCE(chip7); \ | ||
| 230 | SENSORS_MODULE_PARM_FORCE(chip8); \ | ||
| 231 | static struct i2c_force_data forces[] = {{force,any_chip}, \ | ||
| 232 | {force_ ## chip1,chip1}, \ | ||
| 233 | {force_ ## chip2,chip2}, \ | ||
| 234 | {force_ ## chip3,chip3}, \ | ||
| 235 | {force_ ## chip4,chip4}, \ | ||
| 236 | {force_ ## chip5,chip5}, \ | ||
| 237 | {force_ ## chip6,chip6}, \ | ||
| 238 | {force_ ## chip7,chip7}, \ | ||
| 239 | {force_ ## chip8,chip8}, \ | ||
| 240 | {NULL}}; \ | ||
| 241 | SENSORS_INSMOD | ||
| 242 | |||
| 243 | /* Detect function. It iterates over all possible addresses itself. For | ||
| 244 | SMBus addresses, it will only call found_proc if some client is connected | ||
| 245 | to the SMBus (unless a 'force' matched); for ISA detections, this is not | ||
| 246 | done. */ | ||
| 247 | extern int i2c_detect(struct i2c_adapter *adapter, | ||
| 248 | struct i2c_address_data *address_data, | ||
| 249 | int (*found_proc) (struct i2c_adapter *, int, int)); | ||
| 250 | |||
| 251 | |||
| 252 | /* This macro is used to scale user-input to sensible values in almost all | ||
| 253 | chip drivers. */ | ||
| 254 | static inline int SENSORS_LIMIT(long value, long low, long high) | ||
| 255 | { | ||
| 256 | if (value < low) | ||
| 257 | return low; | ||
| 258 | else if (value > high) | ||
| 259 | return high; | ||
| 260 | else | ||
| 261 | return value; | ||
| 262 | } | ||
| 263 | #endif /* def _LINUX_I2C_SENSOR_H */ | ||
diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h deleted file mode 100644 index 41d0635e0ba9..000000000000 --- a/include/linux/i2c-vid.h +++ /dev/null | |||
| @@ -1,111 +0,0 @@ | |||
| 1 | /* | ||
| 2 | i2c-vid.h - Part of lm_sensors, Linux kernel modules for hardware | ||
| 3 | monitoring | ||
| 4 | Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | ||
| 5 | With assistance from Trent Piepho <xyzzy@speakeasy.org> | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 2 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; if not, write to the Free Software | ||
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | This file contains common code for decoding VID pins. | ||
| 24 | This file is #included in various chip drivers in this directory. | ||
| 25 | As the user is unlikely to load more than one driver which | ||
| 26 | includes this code we don't worry about the wasted space. | ||
| 27 | Reference: VRM x.y DC-DC Converter Design Guidelines, | ||
| 28 | available at http://developer.intel.com | ||
| 29 | */ | ||
| 30 | |||
| 31 | /* | ||
| 32 | AMD Opteron processors don't follow the Intel VRM spec. | ||
| 33 | I'm going to "make up" 2.4 as the VRM spec for the Opterons. | ||
| 34 | No good reason just a mnemonic for the 24x Opteron processor | ||
| 35 | series | ||
| 36 | |||
| 37 | Opteron VID encoding is: | ||
| 38 | |||
| 39 | 00000 = 1.550 V | ||
| 40 | 00001 = 1.525 V | ||
| 41 | . . . . | ||
| 42 | 11110 = 0.800 V | ||
| 43 | 11111 = 0.000 V (off) | ||
| 44 | */ | ||
| 45 | |||
| 46 | /* | ||
| 47 | Legal val values 0x00 - 0x1f; except for VRD 10.0, 0x00 - 0x3f. | ||
| 48 | vrm is the Intel VRM document version. | ||
| 49 | Note: vrm version is scaled by 10 and the return value is scaled by 1000 | ||
| 50 | to avoid floating point in the kernel. | ||
| 51 | */ | ||
| 52 | |||
| 53 | int i2c_which_vrm(void); | ||
| 54 | |||
| 55 | #define DEFAULT_VRM 82 | ||
| 56 | |||
| 57 | static inline int vid_from_reg(int val, int vrm) | ||
| 58 | { | ||
| 59 | int vid; | ||
| 60 | |||
| 61 | switch(vrm) { | ||
| 62 | |||
| 63 | case 0: | ||
| 64 | return 0; | ||
| 65 | |||
| 66 | case 100: /* VRD 10.0 */ | ||
| 67 | if((val & 0x1f) == 0x1f) | ||
| 68 | return 0; | ||
| 69 | if((val & 0x1f) <= 0x09 || val == 0x0a) | ||
| 70 | vid = 10875 - (val & 0x1f) * 250; | ||
| 71 | else | ||
| 72 | vid = 18625 - (val & 0x1f) * 250; | ||
| 73 | if(val & 0x20) | ||
| 74 | vid -= 125; | ||
| 75 | vid /= 10; /* only return 3 dec. places for now */ | ||
| 76 | return vid; | ||
| 77 | |||
| 78 | case 24: /* Opteron processor */ | ||
| 79 | return(val == 0x1f ? 0 : 1550 - val * 25); | ||
| 80 | |||
| 81 | case 91: /* VRM 9.1 */ | ||
| 82 | case 90: /* VRM 9.0 */ | ||
| 83 | return(val == 0x1f ? 0 : | ||
| 84 | 1850 - val * 25); | ||
| 85 | |||
| 86 | case 85: /* VRM 8.5 */ | ||
| 87 | return((val & 0x10 ? 25 : 0) + | ||
| 88 | ((val & 0x0f) > 0x04 ? 2050 : 1250) - | ||
| 89 | ((val & 0x0f) * 50)); | ||
| 90 | |||
| 91 | case 84: /* VRM 8.4 */ | ||
| 92 | val &= 0x0f; | ||
| 93 | /* fall through */ | ||
| 94 | default: /* VRM 8.2 */ | ||
| 95 | return(val == 0x1f ? 0 : | ||
| 96 | val & 0x10 ? 5100 - (val) * 100 : | ||
| 97 | 2050 - (val) * 50); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline int vid_to_reg(int val, int vrm) | ||
| 102 | { | ||
| 103 | switch (vrm) { | ||
| 104 | case 91: /* VRM 9.1 */ | ||
| 105 | case 90: /* VRM 9.0 */ | ||
| 106 | return ((val >= 1100) && (val <= 1850) ? | ||
| 107 | ((18499 - val * 10) / 25 + 5) / 10 : -1); | ||
| 108 | default: | ||
| 109 | return -1; | ||
| 110 | } | ||
| 111 | } | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index be837b13f297..be35332b67e6 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -34,6 +34,13 @@ | |||
| 34 | #include <linux/device.h> /* for struct device */ | 34 | #include <linux/device.h> /* for struct device */ |
| 35 | #include <asm/semaphore.h> | 35 | #include <asm/semaphore.h> |
| 36 | 36 | ||
| 37 | /* --- For i2c-isa ---------------------------------------------------- */ | ||
| 38 | |||
| 39 | extern void i2c_adapter_dev_release(struct device *dev); | ||
| 40 | extern struct device_driver i2c_adapter_driver; | ||
| 41 | extern struct class i2c_adapter_class; | ||
| 42 | extern struct bus_type i2c_bus_type; | ||
| 43 | |||
| 37 | /* --- General options ------------------------------------------------ */ | 44 | /* --- General options ------------------------------------------------ */ |
| 38 | 45 | ||
| 39 | struct i2c_msg; | 46 | struct i2c_msg; |
| @@ -41,7 +48,6 @@ struct i2c_algorithm; | |||
| 41 | struct i2c_adapter; | 48 | struct i2c_adapter; |
| 42 | struct i2c_client; | 49 | struct i2c_client; |
| 43 | struct i2c_driver; | 50 | struct i2c_driver; |
| 44 | struct i2c_client_address_data; | ||
| 45 | union i2c_smbus_data; | 51 | union i2c_smbus_data; |
| 46 | 52 | ||
| 47 | /* | 53 | /* |
| @@ -143,12 +149,9 @@ struct i2c_driver { | |||
| 143 | */ | 149 | */ |
| 144 | struct i2c_client { | 150 | struct i2c_client { |
| 145 | unsigned int flags; /* div., see below */ | 151 | unsigned int flags; /* div., see below */ |
| 146 | unsigned int addr; /* chip address - NOTE: 7bit */ | 152 | unsigned short addr; /* chip address - NOTE: 7bit */ |
| 147 | /* addresses are stored in the */ | 153 | /* addresses are stored in the */ |
| 148 | /* _LOWER_ 7 bits of this char */ | 154 | /* _LOWER_ 7 bits */ |
| 149 | /* addr: unsigned int to make lm_sensors i2c-isa adapter work | ||
| 150 | more cleanly. It does not take any more memory space, due to | ||
| 151 | alignment considerations */ | ||
| 152 | struct i2c_adapter *adapter; /* the adapter we sit on */ | 155 | struct i2c_adapter *adapter; /* the adapter we sit on */ |
| 153 | struct i2c_driver *driver; /* and our access routines */ | 156 | struct i2c_driver *driver; /* and our access routines */ |
| 154 | int usage_count; /* How many accesses currently */ | 157 | int usage_count; /* How many accesses currently */ |
| @@ -160,6 +163,11 @@ struct i2c_client { | |||
| 160 | }; | 163 | }; |
| 161 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) | 164 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) |
| 162 | 165 | ||
| 166 | static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) | ||
| 167 | { | ||
| 168 | return to_i2c_client(container_of(kobj, struct device, kobj)); | ||
| 169 | } | ||
| 170 | |||
| 163 | static inline void *i2c_get_clientdata (struct i2c_client *dev) | 171 | static inline void *i2c_get_clientdata (struct i2c_client *dev) |
| 164 | { | 172 | { |
| 165 | return dev_get_drvdata (&dev->dev); | 173 | return dev_get_drvdata (&dev->dev); |
| @@ -170,13 +178,6 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | |||
| 170 | dev_set_drvdata (&dev->dev, data); | 178 | dev_set_drvdata (&dev->dev, data); |
| 171 | } | 179 | } |
| 172 | 180 | ||
| 173 | #define I2C_DEVNAME(str) .name = str | ||
| 174 | |||
| 175 | static inline char *i2c_clientname(struct i2c_client *c) | ||
| 176 | { | ||
| 177 | return &c->name[0]; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* | 181 | /* |
| 181 | * The following structs are for those who like to implement new bus drivers: | 182 | * The following structs are for those who like to implement new bus drivers: |
| 182 | * i2c_algorithm is the interface to a class of hardware solutions which can | 183 | * i2c_algorithm is the interface to a class of hardware solutions which can |
| @@ -184,9 +185,6 @@ static inline char *i2c_clientname(struct i2c_client *c) | |||
| 184 | * to name two of the most common. | 185 | * to name two of the most common. |
| 185 | */ | 186 | */ |
| 186 | struct i2c_algorithm { | 187 | struct i2c_algorithm { |
| 187 | char name[32]; /* textual description */ | ||
| 188 | unsigned int id; | ||
| 189 | |||
| 190 | /* If an adapter algorithm can't do I2C-level access, set master_xfer | 188 | /* If an adapter algorithm can't do I2C-level access, set master_xfer |
| 191 | to NULL. If an adapter algorithm can do SMBus access, set | 189 | to NULL. If an adapter algorithm can do SMBus access, set |
| 192 | smbus_xfer. If set to NULL, the SMBus protocol is simulated | 190 | smbus_xfer. If set to NULL, the SMBus protocol is simulated |
| @@ -214,8 +212,7 @@ struct i2c_algorithm { | |||
| 214 | */ | 212 | */ |
| 215 | struct i2c_adapter { | 213 | struct i2c_adapter { |
| 216 | struct module *owner; | 214 | struct module *owner; |
| 217 | unsigned int id;/* == is algo->id | hwdep.struct->id, */ | 215 | unsigned int id; |
| 218 | /* for registered values see below */ | ||
| 219 | unsigned int class; | 216 | unsigned int class; |
| 220 | struct i2c_algorithm *algo;/* the algorithm to access the bus */ | 217 | struct i2c_algorithm *algo;/* the algorithm to access the bus */ |
| 221 | void *algo_data; | 218 | void *algo_data; |
| @@ -292,12 +289,11 @@ struct i2c_client_address_data { | |||
| 292 | unsigned short *normal_i2c; | 289 | unsigned short *normal_i2c; |
| 293 | unsigned short *probe; | 290 | unsigned short *probe; |
| 294 | unsigned short *ignore; | 291 | unsigned short *ignore; |
| 295 | unsigned short *force; | 292 | unsigned short **forces; |
| 296 | }; | 293 | }; |
| 297 | 294 | ||
| 298 | /* Internal numbers to terminate lists */ | 295 | /* Internal numbers to terminate lists */ |
| 299 | #define I2C_CLIENT_END 0xfffeU | 296 | #define I2C_CLIENT_END 0xfffeU |
| 300 | #define I2C_CLIENT_ISA_END 0xfffefffeU | ||
| 301 | 297 | ||
| 302 | /* The numbers to use to set I2C bus address */ | 298 | /* The numbers to use to set I2C bus address */ |
| 303 | #define ANY_I2C_BUS 0xffff | 299 | #define ANY_I2C_BUS 0xffff |
| @@ -356,10 +352,6 @@ extern int i2c_probe(struct i2c_adapter *adapter, | |||
| 356 | */ | 352 | */ |
| 357 | extern int i2c_control(struct i2c_client *,unsigned int, unsigned long); | 353 | extern int i2c_control(struct i2c_client *,unsigned int, unsigned long); |
| 358 | 354 | ||
| 359 | /* This call returns a unique low identifier for each registered adapter, | ||
| 360 | * or -1 if the adapter was not registered. | ||
| 361 | */ | ||
| 362 | extern int i2c_adapter_id(struct i2c_adapter *adap); | ||
| 363 | extern struct i2c_adapter* i2c_get_adapter(int id); | 355 | extern struct i2c_adapter* i2c_get_adapter(int id); |
| 364 | extern void i2c_put_adapter(struct i2c_adapter *adap); | 356 | extern void i2c_put_adapter(struct i2c_adapter *adap); |
| 365 | 357 | ||
| @@ -376,6 +368,12 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func) | |||
| 376 | return (func & i2c_get_functionality(adap)) == func; | 368 | return (func & i2c_get_functionality(adap)) == func; |
| 377 | } | 369 | } |
| 378 | 370 | ||
| 371 | /* Return id number for a specific adapter */ | ||
| 372 | static inline int i2c_adapter_id(struct i2c_adapter *adap) | ||
| 373 | { | ||
| 374 | return adap->nr; | ||
| 375 | } | ||
| 376 | |||
| 379 | /* | 377 | /* |
| 380 | * I2C Message - used for pure i2c transaction, also from /dev interface | 378 | * I2C Message - used for pure i2c transaction, also from /dev interface |
| 381 | */ | 379 | */ |
| @@ -510,9 +508,6 @@ union i2c_smbus_data { | |||
| 510 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality */ | 508 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality */ |
| 511 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/ | 509 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/ |
| 512 | #define I2C_PEC 0x0708 /* != 0 for SMBus PEC */ | 510 | #define I2C_PEC 0x0708 /* != 0 for SMBus PEC */ |
| 513 | #if 0 | ||
| 514 | #define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific address */ | ||
| 515 | #endif | ||
| 516 | 511 | ||
| 517 | #define I2C_SMBUS 0x0720 /* SMBus-level access */ | 512 | #define I2C_SMBUS 0x0720 /* SMBus-level access */ |
| 518 | 513 | ||
| @@ -556,27 +551,148 @@ union i2c_smbus_data { | |||
| 556 | module_param_array(var, short, &var##_num, 0); \ | 551 | module_param_array(var, short, &var##_num, 0); \ |
| 557 | MODULE_PARM_DESC(var,desc) | 552 | MODULE_PARM_DESC(var,desc) |
| 558 | 553 | ||
| 559 | /* This is the one you want to use in your own modules */ | 554 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ |
| 555 | I2C_CLIENT_MODULE_PARM(force_##name, \ | ||
| 556 | "List of adapter,address pairs which are " \ | ||
| 557 | "unquestionably assumed to contain a `" \ | ||
| 558 | # name "' chip") | ||
| 559 | |||
| 560 | |||
| 561 | #define I2C_CLIENT_INSMOD_COMMON \ | ||
| 562 | I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ | ||
| 563 | "additionally"); \ | ||
| 564 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ | ||
| 565 | "scan"); \ | ||
| 566 | static struct i2c_client_address_data addr_data = { \ | ||
| 567 | .normal_i2c = normal_i2c, \ | ||
| 568 | .probe = probe, \ | ||
| 569 | .ignore = ignore, \ | ||
| 570 | .forces = forces, \ | ||
| 571 | } | ||
| 572 | |||
| 573 | /* These are the ones you want to use in your own drivers. Pick the one | ||
| 574 | which matches the number of devices the driver differenciates between. */ | ||
| 560 | #define I2C_CLIENT_INSMOD \ | 575 | #define I2C_CLIENT_INSMOD \ |
| 561 | I2C_CLIENT_MODULE_PARM(probe, \ | ||
| 562 | "List of adapter,address pairs to scan additionally"); \ | ||
| 563 | I2C_CLIENT_MODULE_PARM(ignore, \ | ||
| 564 | "List of adapter,address pairs not to scan"); \ | ||
| 565 | I2C_CLIENT_MODULE_PARM(force, \ | 576 | I2C_CLIENT_MODULE_PARM(force, \ |
| 566 | "List of adapter,address pairs to boldly assume " \ | 577 | "List of adapter,address pairs to boldly assume " \ |
| 567 | "to be present"); \ | 578 | "to be present"); \ |
| 568 | static struct i2c_client_address_data addr_data = { \ | 579 | static unsigned short *forces[] = { \ |
| 569 | .normal_i2c = normal_i2c, \ | 580 | force, \ |
| 570 | .probe = probe, \ | 581 | NULL \ |
| 571 | .ignore = ignore, \ | 582 | }; \ |
| 572 | .force = force, \ | 583 | I2C_CLIENT_INSMOD_COMMON |
| 573 | } | 584 | |
| 574 | 585 | #define I2C_CLIENT_INSMOD_1(chip1) \ | |
| 575 | /* Detect whether we are on the isa bus. If this returns true, all i2c | 586 | enum chips { any_chip, chip1 }; \ |
| 576 | access will fail! */ | 587 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ |
| 577 | #define i2c_is_isa_client(clientptr) \ | 588 | "boldly assume to be present"); \ |
| 578 | ((clientptr)->adapter->algo->id == I2C_ALGO_ISA) | 589 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
| 579 | #define i2c_is_isa_adapter(adapptr) \ | 590 | static unsigned short *forces[] = { force, force_##chip1, NULL }; \ |
| 580 | ((adapptr)->algo->id == I2C_ALGO_ISA) | 591 | I2C_CLIENT_INSMOD_COMMON |
| 592 | |||
| 593 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | ||
| 594 | enum chips { any_chip, chip1, chip2 }; \ | ||
| 595 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 596 | "boldly assume to be present"); \ | ||
| 597 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 598 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 599 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 600 | force_##chip2, NULL }; \ | ||
| 601 | I2C_CLIENT_INSMOD_COMMON | ||
| 602 | |||
| 603 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | ||
| 604 | enum chips { any_chip, chip1, chip2, chip3 }; \ | ||
| 605 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 606 | "boldly assume to be present"); \ | ||
| 607 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 608 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 609 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 610 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 611 | force_##chip2, force_##chip3, \ | ||
| 612 | NULL }; \ | ||
| 613 | I2C_CLIENT_INSMOD_COMMON | ||
| 614 | |||
| 615 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ | ||
| 616 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | ||
| 617 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 618 | "boldly assume to be present"); \ | ||
| 619 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 620 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 621 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 622 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 623 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 624 | force_##chip2, force_##chip3, \ | ||
| 625 | force_##chip4, NULL}; \ | ||
| 626 | I2C_CLIENT_INSMOD_COMMON | ||
| 627 | |||
| 628 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ | ||
| 629 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | ||
| 630 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 631 | "boldly assume to be present"); \ | ||
| 632 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 633 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 634 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 635 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 636 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 637 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 638 | force_##chip2, force_##chip3, \ | ||
| 639 | force_##chip4, force_##chip5, \ | ||
| 640 | NULL }; \ | ||
| 641 | I2C_CLIENT_INSMOD_COMMON | ||
| 642 | |||
| 643 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ | ||
| 644 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | ||
| 645 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 646 | "boldly assume to be present"); \ | ||
| 647 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 648 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 649 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 650 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 651 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 652 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 653 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 654 | force_##chip2, force_##chip3, \ | ||
| 655 | force_##chip4, force_##chip5, \ | ||
| 656 | force_##chip6, NULL }; \ | ||
| 657 | I2C_CLIENT_INSMOD_COMMON | ||
| 658 | |||
| 659 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ | ||
| 660 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
| 661 | chip7 }; \ | ||
| 662 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 663 | "boldly assume to be present"); \ | ||
| 664 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 665 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 666 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 667 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 668 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 669 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 670 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
| 671 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 672 | force_##chip2, force_##chip3, \ | ||
| 673 | force_##chip4, force_##chip5, \ | ||
| 674 | force_##chip6, force_##chip7, \ | ||
| 675 | NULL }; \ | ||
| 676 | I2C_CLIENT_INSMOD_COMMON | ||
| 677 | |||
| 678 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ | ||
| 679 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
| 680 | chip7, chip8 }; \ | ||
| 681 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
| 682 | "boldly assume to be present"); \ | ||
| 683 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
| 684 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
| 685 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
| 686 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
| 687 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
| 688 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
| 689 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
| 690 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ | ||
| 691 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
| 692 | force_##chip2, force_##chip3, \ | ||
| 693 | force_##chip4, force_##chip5, \ | ||
| 694 | force_##chip6, force_##chip7, \ | ||
| 695 | force_##chip8, NULL }; \ | ||
| 696 | I2C_CLIENT_INSMOD_COMMON | ||
| 581 | 697 | ||
| 582 | #endif /* _LINUX_I2C_H */ | 698 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 92129078d4f3..a6dbb51ecd7b 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -1501,4 +1501,10 @@ extern struct bus_type ide_bus_type; | |||
| 1501 | #define ide_id_has_flush_cache_ext(id) \ | 1501 | #define ide_id_has_flush_cache_ext(id) \ |
| 1502 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | 1502 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) |
| 1503 | 1503 | ||
| 1504 | static inline int hwif_to_node(ide_hwif_t *hwif) | ||
| 1505 | { | ||
| 1506 | struct pci_dev *dev = hwif->pci_dev; | ||
| 1507 | return dev ? pcibus_to_node(dev->bus) : -1; | ||
| 1508 | } | ||
| 1509 | |||
| 1504 | #endif /* _IDE_H */ | 1510 | #endif /* _IDE_H */ |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index b5b58e9c054c..fc2d4c8225aa 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
| @@ -110,6 +110,8 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | |||
| 110 | { | 110 | { |
| 111 | return (struct ethhdr *)skb->mac.raw; | 111 | return (struct ethhdr *)skb->mac.raw; |
| 112 | } | 112 | } |
| 113 | |||
| 114 | extern struct ctl_table ether_table[]; | ||
| 113 | #endif | 115 | #endif |
| 114 | 116 | ||
| 115 | #endif /* _LINUX_IF_ETHER_H */ | 117 | #endif /* _LINUX_IF_ETHER_H */ |
diff --git a/include/linux/if_fc.h b/include/linux/if_fc.h index 33330b458b95..376a34ea4723 100644 --- a/include/linux/if_fc.h +++ b/include/linux/if_fc.h | |||
| @@ -44,7 +44,7 @@ struct fcllc { | |||
| 44 | __u8 ssap; /* source SAP */ | 44 | __u8 ssap; /* source SAP */ |
| 45 | __u8 llc; /* LLC control field */ | 45 | __u8 llc; /* LLC control field */ |
| 46 | __u8 protid[3]; /* protocol id */ | 46 | __u8 protid[3]; /* protocol id */ |
| 47 | __u16 ethertype; /* ether type field */ | 47 | __be16 ethertype; /* ether type field */ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | #endif /* _LINUX_IF_FC_H */ | 50 | #endif /* _LINUX_IF_FC_H */ |
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h index a912818e6361..1288a161bc0b 100644 --- a/include/linux/if_fddi.h +++ b/include/linux/if_fddi.h | |||
| @@ -85,7 +85,7 @@ struct fddi_snap_hdr | |||
| 85 | __u8 ssap; /* always 0xAA */ | 85 | __u8 ssap; /* always 0xAA */ |
| 86 | __u8 ctrl; /* always 0x03 */ | 86 | __u8 ctrl; /* always 0x03 */ |
| 87 | __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ | 87 | __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ |
| 88 | __u16 ethertype; /* packet type ID field */ | 88 | __be16 ethertype; /* packet type ID field */ |
| 89 | } __attribute__ ((packed)); | 89 | } __attribute__ ((packed)); |
| 90 | 90 | ||
| 91 | /* Define FDDI LLC frame header */ | 91 | /* Define FDDI LLC frame header */ |
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h index 3c94b1736570..511999c7eeda 100644 --- a/include/linux/if_frad.h +++ b/include/linux/if_frad.h | |||
| @@ -191,10 +191,12 @@ struct frad_local | |||
| 191 | int buffer; /* current buffer for S508 firmware */ | 191 | int buffer; /* current buffer for S508 firmware */ |
| 192 | }; | 192 | }; |
| 193 | 193 | ||
| 194 | extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); | ||
| 195 | |||
| 196 | #endif /* __KERNEL__ */ | 194 | #endif /* __KERNEL__ */ |
| 197 | 195 | ||
| 198 | #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */ | 196 | #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */ |
| 199 | 197 | ||
| 198 | #ifdef __KERNEL__ | ||
| 199 | extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); | ||
| 200 | #endif | ||
| 201 | |||
| 200 | #endif | 202 | #endif |
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h index c8ca72c46f76..94d31ca7d71a 100644 --- a/include/linux/if_hippi.h +++ b/include/linux/if_hippi.h | |||
| @@ -102,9 +102,9 @@ struct hippi_fp_hdr | |||
| 102 | #error "Please fix <asm/byteorder.h>" | 102 | #error "Please fix <asm/byteorder.h>" |
| 103 | #endif | 103 | #endif |
| 104 | #else | 104 | #else |
| 105 | __u32 fixed; | 105 | __be32 fixed; |
| 106 | #endif | 106 | #endif |
| 107 | __u32 d2_size; | 107 | __be32 d2_size; |
| 108 | } __attribute__ ((packed)); | 108 | } __attribute__ ((packed)); |
| 109 | 109 | ||
| 110 | struct hippi_le_hdr | 110 | struct hippi_le_hdr |
| @@ -144,7 +144,7 @@ struct hippi_snap_hdr | |||
| 144 | __u8 ssap; /* always 0xAA */ | 144 | __u8 ssap; /* always 0xAA */ |
| 145 | __u8 ctrl; /* always 0x03 */ | 145 | __u8 ctrl; /* always 0x03 */ |
| 146 | __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ | 146 | __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ |
| 147 | __u16 ethertype; /* packet type ID field */ | 147 | __be16 ethertype; /* packet type ID field */ |
| 148 | } __attribute__ ((packed)); | 148 | } __attribute__ ((packed)); |
| 149 | 149 | ||
| 150 | struct hippi_hdr | 150 | struct hippi_hdr |
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 3fba9e2f5427..5502f597cf0e 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h | |||
| @@ -43,12 +43,16 @@ struct trh_hdr { | |||
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | #ifdef __KERNEL__ | 45 | #ifdef __KERNEL__ |
| 46 | #include <linux/config.h> | ||
| 46 | #include <linux/skbuff.h> | 47 | #include <linux/skbuff.h> |
| 47 | 48 | ||
| 48 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) | 49 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) |
| 49 | { | 50 | { |
| 50 | return (struct trh_hdr *)skb->mac.raw; | 51 | return (struct trh_hdr *)skb->mac.raw; |
| 51 | } | 52 | } |
| 53 | #ifdef CONFIG_SYSCTL | ||
| 54 | extern struct ctl_table tr_table[]; | ||
| 55 | #endif | ||
| 52 | #endif | 56 | #endif |
| 53 | 57 | ||
| 54 | /* This is an Token-Ring LLC structure */ | 58 | /* This is an Token-Ring LLC structure */ |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 096a85a58ae5..88aef7b86ef4 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
| @@ -77,6 +77,7 @@ struct tun_struct { | |||
| 77 | #define TUNSETIFF _IOW('T', 202, int) | 77 | #define TUNSETIFF _IOW('T', 202, int) |
| 78 | #define TUNSETPERSIST _IOW('T', 203, int) | 78 | #define TUNSETPERSIST _IOW('T', 203, int) |
| 79 | #define TUNSETOWNER _IOW('T', 204, int) | 79 | #define TUNSETOWNER _IOW('T', 204, int) |
| 80 | #define TUNSETLINK _IOW('T', 205, int) | ||
| 80 | 81 | ||
| 81 | /* TUNSETIFF ifr flags */ | 82 | /* TUNSETIFF ifr flags */ |
| 82 | #define IFF_TUN 0x0001 | 83 | #define IFF_TUN 0x0001 |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 62a9d89dfbe2..17d0c0d40b0e 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -155,7 +155,6 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | |||
| 155 | { | 155 | { |
| 156 | struct net_device_stats *stats; | 156 | struct net_device_stats *stats; |
| 157 | 157 | ||
| 158 | skb->real_dev = skb->dev; | ||
| 159 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; | 158 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; |
| 160 | if (skb->dev == NULL) { | 159 | if (skb->dev == NULL) { |
| 161 | dev_kfree_skb_any(skb); | 160 | dev_kfree_skb_any(skb); |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 0c31ef0b5bad..28f4f3b36950 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
| @@ -129,6 +129,9 @@ struct igmpv3_query { | |||
| 129 | #include <linux/skbuff.h> | 129 | #include <linux/skbuff.h> |
| 130 | #include <linux/in.h> | 130 | #include <linux/in.h> |
| 131 | 131 | ||
| 132 | extern int sysctl_igmp_max_memberships; | ||
| 133 | extern int sysctl_igmp_max_msf; | ||
| 134 | |||
| 132 | struct ip_sf_socklist | 135 | struct ip_sf_socklist |
| 133 | { | 136 | { |
| 134 | unsigned int sl_max; | 137 | unsigned int sl_max; |
diff --git a/include/linux/in.h b/include/linux/in.h index fb88c66d748d..ba355384016a 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
| @@ -32,6 +32,7 @@ enum { | |||
| 32 | IPPROTO_PUP = 12, /* PUP protocol */ | 32 | IPPROTO_PUP = 12, /* PUP protocol */ |
| 33 | IPPROTO_UDP = 17, /* User Datagram Protocol */ | 33 | IPPROTO_UDP = 17, /* User Datagram Protocol */ |
| 34 | IPPROTO_IDP = 22, /* XNS IDP protocol */ | 34 | IPPROTO_IDP = 22, /* XNS IDP protocol */ |
| 35 | IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ | ||
| 35 | IPPROTO_RSVP = 46, /* RSVP protocol */ | 36 | IPPROTO_RSVP = 46, /* RSVP protocol */ |
| 36 | IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ | 37 | IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ |
| 37 | 38 | ||
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h new file mode 100644 index 000000000000..a4606e5810e5 --- /dev/null +++ b/include/linux/inet_diag.h | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | #ifndef _INET_DIAG_H_ | ||
| 2 | #define _INET_DIAG_H_ 1 | ||
| 3 | |||
| 4 | /* Just some random number */ | ||
| 5 | #define TCPDIAG_GETSOCK 18 | ||
| 6 | #define DCCPDIAG_GETSOCK 19 | ||
| 7 | |||
| 8 | #define INET_DIAG_GETSOCK_MAX 24 | ||
| 9 | |||
| 10 | /* Socket identity */ | ||
| 11 | struct inet_diag_sockid { | ||
| 12 | __u16 idiag_sport; | ||
| 13 | __u16 idiag_dport; | ||
| 14 | __u32 idiag_src[4]; | ||
| 15 | __u32 idiag_dst[4]; | ||
| 16 | __u32 idiag_if; | ||
| 17 | __u32 idiag_cookie[2]; | ||
| 18 | #define INET_DIAG_NOCOOKIE (~0U) | ||
| 19 | }; | ||
| 20 | |||
| 21 | /* Request structure */ | ||
| 22 | |||
| 23 | struct inet_diag_req { | ||
| 24 | __u8 idiag_family; /* Family of addresses. */ | ||
| 25 | __u8 idiag_src_len; | ||
| 26 | __u8 idiag_dst_len; | ||
| 27 | __u8 idiag_ext; /* Query extended information */ | ||
| 28 | |||
| 29 | struct inet_diag_sockid id; | ||
| 30 | |||
| 31 | __u32 idiag_states; /* States to dump */ | ||
| 32 | __u32 idiag_dbs; /* Tables to dump (NI) */ | ||
| 33 | }; | ||
| 34 | |||
| 35 | enum { | ||
| 36 | INET_DIAG_REQ_NONE, | ||
| 37 | INET_DIAG_REQ_BYTECODE, | ||
| 38 | }; | ||
| 39 | |||
| 40 | #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE | ||
| 41 | |||
| 42 | /* Bytecode is sequence of 4 byte commands followed by variable arguments. | ||
| 43 | * All the commands identified by "code" are conditional jumps forward: | ||
| 44 | * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be | ||
| 45 | * length of the command and its arguments. | ||
| 46 | */ | ||
| 47 | |||
| 48 | struct inet_diag_bc_op { | ||
| 49 | unsigned char code; | ||
| 50 | unsigned char yes; | ||
| 51 | unsigned short no; | ||
| 52 | }; | ||
| 53 | |||
| 54 | enum { | ||
| 55 | INET_DIAG_BC_NOP, | ||
| 56 | INET_DIAG_BC_JMP, | ||
| 57 | INET_DIAG_BC_S_GE, | ||
| 58 | INET_DIAG_BC_S_LE, | ||
| 59 | INET_DIAG_BC_D_GE, | ||
| 60 | INET_DIAG_BC_D_LE, | ||
| 61 | INET_DIAG_BC_AUTO, | ||
| 62 | INET_DIAG_BC_S_COND, | ||
| 63 | INET_DIAG_BC_D_COND, | ||
| 64 | }; | ||
| 65 | |||
| 66 | struct inet_diag_hostcond { | ||
| 67 | __u8 family; | ||
| 68 | __u8 prefix_len; | ||
| 69 | int port; | ||
| 70 | __u32 addr[0]; | ||
| 71 | }; | ||
| 72 | |||
| 73 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | ||
| 74 | * and, alas, the information shown by netstat. */ | ||
| 75 | struct inet_diag_msg { | ||
| 76 | __u8 idiag_family; | ||
| 77 | __u8 idiag_state; | ||
| 78 | __u8 idiag_timer; | ||
| 79 | __u8 idiag_retrans; | ||
| 80 | |||
| 81 | struct inet_diag_sockid id; | ||
| 82 | |||
| 83 | __u32 idiag_expires; | ||
| 84 | __u32 idiag_rqueue; | ||
| 85 | __u32 idiag_wqueue; | ||
| 86 | __u32 idiag_uid; | ||
| 87 | __u32 idiag_inode; | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* Extensions */ | ||
| 91 | |||
| 92 | enum { | ||
| 93 | INET_DIAG_NONE, | ||
| 94 | INET_DIAG_MEMINFO, | ||
| 95 | INET_DIAG_INFO, | ||
| 96 | INET_DIAG_VEGASINFO, | ||
| 97 | INET_DIAG_CONG, | ||
| 98 | }; | ||
| 99 | |||
| 100 | #define INET_DIAG_MAX INET_DIAG_CONG | ||
| 101 | |||
| 102 | |||
| 103 | /* INET_DIAG_MEM */ | ||
| 104 | |||
| 105 | struct inet_diag_meminfo { | ||
| 106 | __u32 idiag_rmem; | ||
| 107 | __u32 idiag_wmem; | ||
| 108 | __u32 idiag_fmem; | ||
| 109 | __u32 idiag_tmem; | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* INET_DIAG_VEGASINFO */ | ||
| 113 | |||
| 114 | struct tcpvegas_info { | ||
| 115 | __u32 tcpv_enabled; | ||
| 116 | __u32 tcpv_rttcnt; | ||
| 117 | __u32 tcpv_rtt; | ||
| 118 | __u32 tcpv_minrtt; | ||
| 119 | }; | ||
| 120 | |||
| 121 | #ifdef __KERNEL__ | ||
| 122 | struct sock; | ||
| 123 | struct inet_hashinfo; | ||
| 124 | |||
| 125 | struct inet_diag_handler { | ||
| 126 | struct inet_hashinfo *idiag_hashinfo; | ||
| 127 | void (*idiag_get_info)(struct sock *sk, | ||
| 128 | struct inet_diag_msg *r, | ||
| 129 | void *info); | ||
| 130 | __u16 idiag_info_size; | ||
| 131 | __u16 idiag_type; | ||
| 132 | }; | ||
| 133 | |||
| 134 | extern int inet_diag_register(const struct inet_diag_handler *handler); | ||
| 135 | extern void inet_diag_unregister(const struct inet_diag_handler *handler); | ||
| 136 | #endif /* __KERNEL__ */ | ||
| 137 | |||
| 138 | #endif /* _INET_DIAG_H_ */ | ||
diff --git a/include/linux/inotify.h b/include/linux/inotify.h new file mode 100644 index 000000000000..93bb3afe646b --- /dev/null +++ b/include/linux/inotify.h | |||
| @@ -0,0 +1,110 @@ | |||
| 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 | #define IN_MOVE_SELF 0x00000800 /* Self was moved */ | ||
| 39 | |||
| 40 | /* the following are legal events. they are sent as needed to any watch */ | ||
| 41 | #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ | ||
| 42 | #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ | ||
| 43 | #define IN_IGNORED 0x00008000 /* File was ignored */ | ||
| 44 | |||
| 45 | /* helper events */ | ||
| 46 | #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ | ||
| 47 | #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ | ||
| 48 | |||
| 49 | /* special flags */ | ||
| 50 | #define IN_ISDIR 0x40000000 /* event occurred against dir */ | ||
| 51 | #define IN_ONESHOT 0x80000000 /* only send event once */ | ||
| 52 | |||
| 53 | /* | ||
| 54 | * All of the events - we build the list by hand so that we can add flags in | ||
| 55 | * the future and not break backward compatibility. Apps will get only the | ||
| 56 | * events that they originally wanted. Be sure to add new events here! | ||
| 57 | */ | ||
| 58 | #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ | ||
| 59 | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ | ||
| 60 | IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ | ||
| 61 | IN_MOVE_SELF) | ||
| 62 | |||
| 63 | #ifdef __KERNEL__ | ||
| 64 | |||
| 65 | #include <linux/dcache.h> | ||
| 66 | #include <linux/fs.h> | ||
| 67 | #include <linux/config.h> | ||
| 68 | |||
| 69 | #ifdef CONFIG_INOTIFY | ||
| 70 | |||
| 71 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | ||
| 72 | const char *); | ||
| 73 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | ||
| 74 | const char *); | ||
| 75 | extern void inotify_unmount_inodes(struct list_head *); | ||
| 76 | extern void inotify_inode_is_dead(struct inode *); | ||
| 77 | extern u32 inotify_get_cookie(void); | ||
| 78 | |||
| 79 | #else | ||
| 80 | |||
| 81 | static inline void inotify_inode_queue_event(struct inode *inode, | ||
| 82 | __u32 mask, __u32 cookie, | ||
| 83 | const char *filename) | ||
| 84 | { | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline void inotify_dentry_parent_queue_event(struct dentry *dentry, | ||
| 88 | __u32 mask, __u32 cookie, | ||
| 89 | const char *filename) | ||
| 90 | { | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline void inotify_unmount_inodes(struct list_head *list) | ||
| 94 | { | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline void inotify_inode_is_dead(struct inode *inode) | ||
| 98 | { | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline u32 inotify_get_cookie(void) | ||
| 102 | { | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | |||
| 106 | #endif /* CONFIG_INOTIFY */ | ||
| 107 | |||
| 108 | #endif /* __KERNEL __ */ | ||
| 109 | |||
| 110 | #endif /* _LINUX_INOTIFY_H */ | ||
diff --git a/include/linux/input.h b/include/linux/input.h index b9cc0ac71f44..bdc53c6cc962 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -811,9 +811,9 @@ struct input_dev { | |||
| 811 | 811 | ||
| 812 | void *private; | 812 | void *private; |
| 813 | 813 | ||
| 814 | char *name; | 814 | const char *name; |
| 815 | char *phys; | 815 | const char *phys; |
| 816 | char *uniq; | 816 | const char *uniq; |
| 817 | struct input_id id; | 817 | struct input_id id; |
| 818 | 818 | ||
| 819 | unsigned long evbit[NBITS(EV_MAX)]; | 819 | unsigned long evbit[NBITS(EV_MAX)]; |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 31e7cedd9f84..33e8a19a1a0f 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
| @@ -196,6 +196,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
| 196 | #endif | 196 | #endif |
| 197 | #endif | 197 | #endif |
| 198 | 198 | ||
| 199 | extern int inet_sk_rebuild_header(struct sock *sk); | ||
| 200 | |||
| 199 | struct iphdr { | 201 | struct iphdr { |
| 200 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 202 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 201 | __u8 ihl:4, | 203 | __u8 ihl:4, |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 6fcd6a0ade24..3c7dbc6a0a70 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -193,6 +193,11 @@ struct inet6_skb_parm { | |||
| 193 | 193 | ||
| 194 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) | 194 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) |
| 195 | 195 | ||
| 196 | static inline int inet6_iif(const struct sk_buff *skb) | ||
| 197 | { | ||
| 198 | return IP6CB(skb)->iif; | ||
| 199 | } | ||
| 200 | |||
| 196 | struct tcp6_request_sock { | 201 | struct tcp6_request_sock { |
| 197 | struct tcp_request_sock req; | 202 | struct tcp_request_sock req; |
| 198 | struct in6_addr loc_addr; | 203 | struct in6_addr loc_addr; |
| @@ -308,6 +313,36 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
| 308 | 313 | ||
| 309 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 314 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) |
| 310 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) | 315 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) |
| 316 | |||
| 317 | #include <linux/tcp.h> | ||
| 318 | |||
| 319 | struct tcp6_timewait_sock { | ||
| 320 | struct tcp_timewait_sock tw_v6_sk; | ||
| 321 | struct in6_addr tw_v6_daddr; | ||
| 322 | struct in6_addr tw_v6_rcv_saddr; | ||
| 323 | }; | ||
| 324 | |||
| 325 | static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) | ||
| 326 | { | ||
| 327 | return (struct tcp6_timewait_sock *)sk; | ||
| 328 | } | ||
| 329 | |||
| 330 | static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) | ||
| 331 | { | ||
| 332 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | ||
| 333 | &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; | ||
| 334 | } | ||
| 335 | |||
| 336 | static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) | ||
| 337 | { | ||
| 338 | return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; | ||
| 339 | } | ||
| 340 | |||
| 341 | static inline int inet_v6_ipv6only(const struct sock *sk) | ||
| 342 | { | ||
| 343 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | ||
| 344 | ipv6_only_sock(sk) : inet_twsk(sk)->tw_ipv6only; | ||
| 345 | } | ||
| 311 | #else | 346 | #else |
| 312 | #define __ipv6_only_sock(sk) 0 | 347 | #define __ipv6_only_sock(sk) 0 |
| 313 | #define ipv6_only_sock(sk) 0 | 348 | #define ipv6_only_sock(sk) 0 |
| @@ -322,8 +357,19 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
| 322 | return NULL; | 357 | return NULL; |
| 323 | } | 358 | } |
| 324 | 359 | ||
| 325 | #endif | 360 | #define __tcp_v6_rcv_saddr(__sk) NULL |
| 361 | #define tcp_v6_rcv_saddr(__sk) NULL | ||
| 362 | #define tcp_twsk_ipv6only(__sk) 0 | ||
| 363 | #define inet_v6_ipv6only(__sk) 0 | ||
| 364 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
| 326 | 365 | ||
| 327 | #endif | 366 | #define INET6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \ |
| 367 | (((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | ||
| 368 | ((__sk)->sk_family == AF_INET6) && \ | ||
| 369 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | ||
| 370 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ | ||
| 371 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | ||
| 328 | 372 | ||
| 329 | #endif | 373 | #endif /* __KERNEL__ */ |
| 374 | |||
| 375 | #endif /* _IPV6_H */ | ||
diff --git a/include/linux/klist.h b/include/linux/klist.h index eebf5e5696ec..c4d1fae4dd89 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
| @@ -9,6 +9,9 @@ | |||
| 9 | * This file is rleased under the GPL v2. | 9 | * This file is rleased under the GPL v2. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #ifndef _LINUX_KLIST_H | ||
| 13 | #define _LINUX_KLIST_H | ||
| 14 | |||
| 12 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 13 | #include <linux/completion.h> | 16 | #include <linux/completion.h> |
| 14 | #include <linux/kref.h> | 17 | #include <linux/kref.h> |
| @@ -31,8 +34,8 @@ struct klist_node { | |||
| 31 | struct completion n_removed; | 34 | struct completion n_removed; |
| 32 | }; | 35 | }; |
| 33 | 36 | ||
| 34 | extern void klist_add_tail(struct klist * k, struct klist_node * n); | 37 | extern void klist_add_tail(struct klist_node * n, struct klist * k); |
| 35 | extern void klist_add_head(struct klist * k, struct klist_node * n); | 38 | extern void klist_add_head(struct klist_node * n, struct klist * k); |
| 36 | 39 | ||
| 37 | extern void klist_del(struct klist_node * n); | 40 | extern void klist_del(struct klist_node * n); |
| 38 | extern void klist_remove(struct klist_node * n); | 41 | extern void klist_remove(struct klist_node * n); |
| @@ -53,3 +56,4 @@ extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, | |||
| 53 | extern void klist_iter_exit(struct klist_iter * i); | 56 | extern void klist_iter_exit(struct klist_iter * i); |
| 54 | extern struct klist_node * klist_next(struct klist_iter * i); | 57 | extern struct klist_node * klist_next(struct klist_iter * i); |
| 55 | 58 | ||
| 59 | #endif | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 6cd9ba63563b..022105c745fc 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -1,23 +1,26 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2003-2004 Red Hat, Inc. All rights reserved. | 2 | * Copyright 2003-2005 Red Hat, Inc. All rights reserved. |
| 3 | Copyright 2003-2004 Jeff Garzik | 3 | * Copyright 2003-2005 Jeff Garzik |
| 4 | 4 | * | |
| 5 | The contents of this file are subject to the Open | 5 | * |
| 6 | Software License version 1.1 that can be found at | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | http://www.opensource.org/licenses/osl-1.1.txt and is included herein | 7 | * it under the terms of the GNU General Public License as published by |
| 8 | by reference. | 8 | * the Free Software Foundation; either version 2, or (at your option) |
| 9 | 9 | * any later version. | |
| 10 | Alternatively, the contents of this file may be used under the terms | 10 | * |
| 11 | of the GNU General Public License version 2 (the "GPL") as distributed | 11 | * This program is distributed in the hope that it will be useful, |
| 12 | in the kernel source COPYING file, in which case the provisions of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | the GPL are applicable instead of the above. If you wish to allow | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | the use of your version of this file only under the terms of the | 14 | * GNU General Public License for more details. |
| 15 | GPL and not to allow others to use your version of this file under | 15 | * |
| 16 | the OSL, indicate your decision by deleting the provisions above and | 16 | * You should have received a copy of the GNU General Public License |
| 17 | replace them with the notice and other provisions required by the GPL. | 17 | * along with this program; see the file COPYING. If not, write to |
| 18 | If you do not delete the provisions above, a recipient may use your | 18 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | version of this file under either the OSL or the GPL. | 19 | * |
| 20 | 20 | * | |
| 21 | * libata documentation is available via 'make {ps|pdf}docs', | ||
| 22 | * as Documentation/DocBook/libata.* | ||
| 23 | * | ||
| 21 | */ | 24 | */ |
| 22 | 25 | ||
| 23 | #ifndef __LINUX_LIBATA_H__ | 26 | #ifndef __LINUX_LIBATA_H__ |
| @@ -37,7 +40,6 @@ | |||
| 37 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 40 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
| 38 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ | 41 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ |
| 39 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ | 42 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ |
| 40 | #undef ATA_ENABLE_ATAPI /* define to enable ATAPI support */ | ||
| 41 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some | 43 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some |
| 42 | * low-level drivers */ | 44 | * low-level drivers */ |
| 43 | #undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */ | 45 | #undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */ |
| @@ -113,6 +115,8 @@ enum { | |||
| 113 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ | 115 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ |
| 114 | ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ | 116 | ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ |
| 115 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ | 117 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ |
| 118 | ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once | ||
| 119 | * proper HSM is in place. */ | ||
| 116 | 120 | ||
| 117 | ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ | 121 | ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ |
| 118 | ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ | 122 | ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ |
| @@ -363,7 +367,7 @@ struct ata_port_operations { | |||
| 363 | 367 | ||
| 364 | void (*host_stop) (struct ata_host_set *host_set); | 368 | void (*host_stop) (struct ata_host_set *host_set); |
| 365 | 369 | ||
| 366 | void (*bmdma_stop) (struct ata_port *ap); | 370 | void (*bmdma_stop) (struct ata_queued_cmd *qc); |
| 367 | u8 (*bmdma_status) (struct ata_port *ap); | 371 | u8 (*bmdma_status) (struct ata_port *ap); |
| 368 | }; | 372 | }; |
| 369 | 373 | ||
| @@ -424,7 +428,7 @@ extern void ata_dev_id_string(u16 *id, unsigned char *s, | |||
| 424 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | 428 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); |
| 425 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 429 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
| 426 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 430 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
| 427 | extern void ata_bmdma_stop(struct ata_port *ap); | 431 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
| 428 | extern u8 ata_bmdma_status(struct ata_port *ap); | 432 | extern u8 ata_bmdma_status(struct ata_port *ap); |
| 429 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 433 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
| 430 | extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); | 434 | extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); |
| @@ -445,6 +449,7 @@ struct pci_bits { | |||
| 445 | unsigned long val; | 449 | unsigned long val; |
| 446 | }; | 450 | }; |
| 447 | 451 | ||
| 452 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | ||
| 448 | extern struct ata_probe_ent * | 453 | extern struct ata_probe_ent * |
| 449 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); | 454 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); |
| 450 | extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); | 455 | extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); |
| @@ -644,7 +649,7 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val) | |||
| 644 | ap->ops->scr_write(ap, reg, val); | 649 | ap->ops->scr_write(ap, reg, val); |
| 645 | } | 650 | } |
| 646 | 651 | ||
| 647 | static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, | 652 | static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, |
| 648 | u32 val) | 653 | u32 val) |
| 649 | { | 654 | { |
| 650 | ap->ops->scr_write(ap, reg, val); | 655 | ap->ops->scr_write(ap, reg, val); |
diff --git a/include/linux/list.h b/include/linux/list.h index aab2db21b013..e6ec59682274 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -419,6 +419,20 @@ static inline void list_splice_init(struct list_head *list, | |||
| 419 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 419 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 420 | 420 | ||
| 421 | /** | 421 | /** |
| 422 | * list_for_each_entry_safe_continue - iterate over list of given type | ||
| 423 | * continuing after existing point safe against removal of list entry | ||
| 424 | * @pos: the type * to use as a loop counter. | ||
| 425 | * @n: another type * to use as temporary storage | ||
| 426 | * @head: the head for your list. | ||
| 427 | * @member: the name of the list_struct within the struct. | ||
| 428 | */ | ||
| 429 | #define list_for_each_entry_safe_continue(pos, n, head, member) \ | ||
| 430 | for (pos = list_entry(pos->member.next, typeof(*pos), member), \ | ||
| 431 | n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
| 432 | &pos->member != (head); \ | ||
| 433 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
| 434 | |||
| 435 | /** | ||
| 422 | * list_for_each_rcu - iterate over an rcu-protected list | 436 | * list_for_each_rcu - iterate over an rcu-protected list |
| 423 | * @pos: the &struct list_head to use as a loop counter. | 437 | * @pos: the &struct list_head to use as a loop counter. |
| 424 | * @head: the head for your list. | 438 | * @head: the head for your list. |
| @@ -620,6 +634,57 @@ static inline void hlist_add_after(struct hlist_node *n, | |||
| 620 | next->next->pprev = &next->next; | 634 | next->next->pprev = &next->next; |
| 621 | } | 635 | } |
| 622 | 636 | ||
| 637 | /** | ||
| 638 | * hlist_add_before_rcu - adds the specified element to the specified hlist | ||
| 639 | * before the specified node while permitting racing traversals. | ||
| 640 | * @n: the new element to add to the hash list. | ||
| 641 | * @next: the existing element to add the new element before. | ||
| 642 | * | ||
| 643 | * The caller must take whatever precautions are necessary | ||
| 644 | * (such as holding appropriate locks) to avoid racing | ||
| 645 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
| 646 | * or hlist_del_rcu(), running on this same list. | ||
| 647 | * However, it is perfectly legal to run concurrently with | ||
| 648 | * the _rcu list-traversal primitives, such as | ||
| 649 | * hlist_for_each_rcu(), used to prevent memory-consistency | ||
| 650 | * problems on Alpha CPUs. | ||
| 651 | */ | ||
| 652 | static inline void hlist_add_before_rcu(struct hlist_node *n, | ||
| 653 | struct hlist_node *next) | ||
| 654 | { | ||
| 655 | n->pprev = next->pprev; | ||
| 656 | n->next = next; | ||
| 657 | smp_wmb(); | ||
| 658 | next->pprev = &n->next; | ||
| 659 | *(n->pprev) = n; | ||
| 660 | } | ||
| 661 | |||
| 662 | /** | ||
| 663 | * hlist_add_after_rcu - adds the specified element to the specified hlist | ||
| 664 | * after the specified node while permitting racing traversals. | ||
| 665 | * @prev: the existing element to add the new element after. | ||
| 666 | * @n: the new element to add to the hash list. | ||
| 667 | * | ||
| 668 | * The caller must take whatever precautions are necessary | ||
| 669 | * (such as holding appropriate locks) to avoid racing | ||
| 670 | * with another list-mutation primitive, such as hlist_add_head_rcu() | ||
| 671 | * or hlist_del_rcu(), running on this same list. | ||
| 672 | * However, it is perfectly legal to run concurrently with | ||
| 673 | * the _rcu list-traversal primitives, such as | ||
| 674 | * hlist_for_each_rcu(), used to prevent memory-consistency | ||
| 675 | * problems on Alpha CPUs. | ||
| 676 | */ | ||
| 677 | static inline void hlist_add_after_rcu(struct hlist_node *prev, | ||
| 678 | struct hlist_node *n) | ||
| 679 | { | ||
| 680 | n->next = prev->next; | ||
| 681 | n->pprev = &prev->next; | ||
| 682 | smp_wmb(); | ||
| 683 | prev->next = n; | ||
| 684 | if (n->next) | ||
| 685 | n->next->pprev = &n->next; | ||
| 686 | } | ||
| 687 | |||
| 623 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | 688 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) |
| 624 | 689 | ||
| 625 | #define hlist_for_each(pos, head) \ | 690 | #define hlist_for_each(pos, head) \ |
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h index 8e5a10410a30..9263d2db2d67 100644 --- a/include/linux/mbcache.h +++ b/include/linux/mbcache.h | |||
| @@ -29,7 +29,7 @@ struct mb_cache_op { | |||
| 29 | 29 | ||
| 30 | struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, | 30 | struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, |
| 31 | int, int); | 31 | int, int); |
| 32 | void mb_cache_shrink(struct mb_cache *, struct block_device *); | 32 | void mb_cache_shrink(struct block_device *); |
| 33 | void mb_cache_destroy(struct mb_cache *); | 33 | void mb_cache_destroy(struct mb_cache *); |
| 34 | 34 | ||
| 35 | /* Functions on cache entries */ | 35 | /* Functions on cache entries */ |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 8480aef10e62..94a46f38c532 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
| @@ -150,6 +150,9 @@ void mpol_free_shared_policy(struct shared_policy *p); | |||
| 150 | struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, | 150 | struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, |
| 151 | unsigned long idx); | 151 | unsigned long idx); |
| 152 | 152 | ||
| 153 | struct mempolicy *get_vma_policy(struct task_struct *task, | ||
| 154 | struct vm_area_struct *vma, unsigned long addr); | ||
| 155 | |||
| 153 | extern void numa_default_policy(void); | 156 | extern void numa_default_policy(void); |
| 154 | extern void numa_policy_init(void); | 157 | extern void numa_policy_init(void); |
| 155 | 158 | ||
diff --git a/include/linux/mii.h b/include/linux/mii.h index 374b615ea9ea..9b8d0476988a 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #define MII_EXPANSION 0x06 /* Expansion register */ | 22 | #define MII_EXPANSION 0x06 /* Expansion register */ |
| 23 | #define MII_CTRL1000 0x09 /* 1000BASE-T control */ | 23 | #define MII_CTRL1000 0x09 /* 1000BASE-T control */ |
| 24 | #define MII_STAT1000 0x0a /* 1000BASE-T status */ | 24 | #define MII_STAT1000 0x0a /* 1000BASE-T status */ |
| 25 | #define MII_ESTATUS 0x0f /* Extended Status */ | ||
| 25 | #define MII_DCOUNTER 0x12 /* Disconnect counter */ | 26 | #define MII_DCOUNTER 0x12 /* Disconnect counter */ |
| 26 | #define MII_FCSCOUNTER 0x13 /* False carrier counter */ | 27 | #define MII_FCSCOUNTER 0x13 /* False carrier counter */ |
| 27 | #define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ | 28 | #define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ |
| @@ -54,7 +55,10 @@ | |||
| 54 | #define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ | 55 | #define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ |
| 55 | #define BMSR_RFAULT 0x0010 /* Remote fault detected */ | 56 | #define BMSR_RFAULT 0x0010 /* Remote fault detected */ |
| 56 | #define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ | 57 | #define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ |
| 57 | #define BMSR_RESV 0x07c0 /* Unused... */ | 58 | #define BMSR_RESV 0x00c0 /* Unused... */ |
| 59 | #define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ | ||
| 60 | #define BMSR_100FULL2 0x0200 /* Can do 100BASE-T2 HDX */ | ||
| 61 | #define BMSR_100HALF2 0x0400 /* Can do 100BASE-T2 FDX */ | ||
| 58 | #define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ | 62 | #define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ |
| 59 | #define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ | 63 | #define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ |
| 60 | #define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ | 64 | #define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ |
| @@ -114,6 +118,9 @@ | |||
| 114 | #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ | 118 | #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ |
| 115 | #define EXPANSION_RESV 0xffe0 /* Unused... */ | 119 | #define EXPANSION_RESV 0xffe0 /* Unused... */ |
| 116 | 120 | ||
| 121 | #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ | ||
| 122 | #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ | ||
| 123 | |||
| 117 | /* N-way test register. */ | 124 | /* N-way test register. */ |
| 118 | #define NWAYTEST_RESV1 0x00ff /* Unused... */ | 125 | #define NWAYTEST_RESV1 0x00ff /* Unused... */ |
| 119 | #define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ | 126 | #define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 6eb7f48317f8..82d7024f0765 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -625,10 +625,16 @@ static inline int page_mapped(struct page *page) | |||
| 625 | * Used to decide whether a process gets delivered SIGBUS or | 625 | * Used to decide whether a process gets delivered SIGBUS or |
| 626 | * just gets major/minor fault counters bumped up. | 626 | * just gets major/minor fault counters bumped up. |
| 627 | */ | 627 | */ |
| 628 | #define VM_FAULT_OOM (-1) | 628 | #define VM_FAULT_OOM 0x00 |
| 629 | #define VM_FAULT_SIGBUS 0 | 629 | #define VM_FAULT_SIGBUS 0x01 |
| 630 | #define VM_FAULT_MINOR 1 | 630 | #define VM_FAULT_MINOR 0x02 |
| 631 | #define VM_FAULT_MAJOR 2 | 631 | #define VM_FAULT_MAJOR 0x03 |
| 632 | |||
| 633 | /* | ||
| 634 | * Special case for get_user_pages. | ||
| 635 | * Must be in a distinct bit from the above VM_FAULT_ flags. | ||
| 636 | */ | ||
| 637 | #define VM_FAULT_WRITE 0x10 | ||
| 632 | 638 | ||
| 633 | #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) | 639 | #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) |
| 634 | 640 | ||
| @@ -704,7 +710,13 @@ extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsign | |||
| 704 | extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)); | 710 | extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)); |
| 705 | extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); | 711 | extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); |
| 706 | extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); | 712 | extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); |
| 707 | extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); | 713 | extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); |
| 714 | |||
| 715 | static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) | ||
| 716 | { | ||
| 717 | return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); | ||
| 718 | } | ||
| 719 | |||
| 708 | extern int make_pages_present(unsigned long addr, unsigned long end); | 720 | extern int make_pages_present(unsigned long addr, unsigned long end); |
| 709 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); | 721 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); |
| 710 | void install_arg_page(struct vm_area_struct *, struct page *, unsigned long); | 722 | void install_arg_page(struct vm_area_struct *, struct page *, unsigned long); |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index f90f674eb3b0..30f68c0c8c6e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -46,6 +46,12 @@ struct mmc_ios { | |||
| 46 | #define MMC_BUSMODE_OPENDRAIN 1 | 46 | #define MMC_BUSMODE_OPENDRAIN 1 |
| 47 | #define MMC_BUSMODE_PUSHPULL 2 | 47 | #define MMC_BUSMODE_PUSHPULL 2 |
| 48 | 48 | ||
| 49 | unsigned char chip_select; /* SPI chip select */ | ||
| 50 | |||
| 51 | #define MMC_CS_DONTCARE 0 | ||
| 52 | #define MMC_CS_HIGH 1 | ||
| 53 | #define MMC_CS_LOW 2 | ||
| 54 | |||
| 49 | unsigned char power_mode; /* power supply mode */ | 55 | unsigned char power_mode; /* power supply mode */ |
| 50 | 56 | ||
| 51 | #define MMC_POWER_OFF 0 | 57 | #define MMC_POWER_OFF 0 |
| @@ -63,11 +69,12 @@ struct device; | |||
| 63 | 69 | ||
| 64 | struct mmc_host { | 70 | struct mmc_host { |
| 65 | struct device *dev; | 71 | struct device *dev; |
| 72 | struct class_device class_dev; | ||
| 73 | int index; | ||
| 66 | struct mmc_host_ops *ops; | 74 | struct mmc_host_ops *ops; |
| 67 | unsigned int f_min; | 75 | unsigned int f_min; |
| 68 | unsigned int f_max; | 76 | unsigned int f_max; |
| 69 | u32 ocr_avail; | 77 | u32 ocr_avail; |
| 70 | char host_name[8]; | ||
| 71 | 78 | ||
| 72 | /* host specific block data */ | 79 | /* host specific block data */ |
| 73 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 80 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
| @@ -97,6 +104,7 @@ extern void mmc_free_host(struct mmc_host *); | |||
| 97 | 104 | ||
| 98 | #define mmc_priv(x) ((void *)((x) + 1)) | 105 | #define mmc_priv(x) ((void *)((x) + 1)) |
| 99 | #define mmc_dev(x) ((x)->dev) | 106 | #define mmc_dev(x) ((x)->dev) |
| 107 | #define mmc_hostname(x) ((x)->class_dev.class_id) | ||
| 100 | 108 | ||
| 101 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 109 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
| 102 | extern int mmc_resume_host(struct mmc_host *); | 110 | extern int mmc_resume_host(struct mmc_host *); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6c90461ed99f..5ed471b58f4f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -487,11 +487,27 @@ struct mem_section { | |||
| 487 | unsigned long section_mem_map; | 487 | unsigned long section_mem_map; |
| 488 | }; | 488 | }; |
| 489 | 489 | ||
| 490 | extern struct mem_section mem_section[NR_MEM_SECTIONS]; | 490 | #ifdef CONFIG_SPARSEMEM_EXTREME |
| 491 | #define SECTIONS_PER_ROOT (PAGE_SIZE / sizeof (struct mem_section)) | ||
| 492 | #else | ||
| 493 | #define SECTIONS_PER_ROOT 1 | ||
| 494 | #endif | ||
| 495 | |||
| 496 | #define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT) | ||
| 497 | #define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT) | ||
| 498 | #define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) | ||
| 499 | |||
| 500 | #ifdef CONFIG_SPARSEMEM_EXTREME | ||
| 501 | extern struct mem_section *mem_section[NR_SECTION_ROOTS]; | ||
| 502 | #else | ||
| 503 | extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; | ||
| 504 | #endif | ||
| 491 | 505 | ||
| 492 | static inline struct mem_section *__nr_to_section(unsigned long nr) | 506 | static inline struct mem_section *__nr_to_section(unsigned long nr) |
| 493 | { | 507 | { |
| 494 | return &mem_section[nr]; | 508 | if (!mem_section[SECTION_NR_TO_ROOT(nr)]) |
| 509 | return NULL; | ||
| 510 | return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; | ||
| 495 | } | 511 | } |
| 496 | 512 | ||
| 497 | /* | 513 | /* |
| @@ -513,12 +529,12 @@ static inline struct page *__section_mem_map_addr(struct mem_section *section) | |||
| 513 | 529 | ||
| 514 | static inline int valid_section(struct mem_section *section) | 530 | static inline int valid_section(struct mem_section *section) |
| 515 | { | 531 | { |
| 516 | return (section->section_mem_map & SECTION_MARKED_PRESENT); | 532 | return (section && (section->section_mem_map & SECTION_MARKED_PRESENT)); |
| 517 | } | 533 | } |
| 518 | 534 | ||
| 519 | static inline int section_has_mem_map(struct mem_section *section) | 535 | static inline int section_has_mem_map(struct mem_section *section) |
| 520 | { | 536 | { |
| 521 | return (section->section_mem_map & SECTION_HAS_MEM_MAP); | 537 | return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); |
| 522 | } | 538 | } |
| 523 | 539 | ||
| 524 | static inline int valid_section_nr(unsigned long nr) | 540 | static inline int valid_section_nr(unsigned long nr) |
| @@ -572,6 +588,7 @@ static inline int pfn_valid(unsigned long pfn) | |||
| 572 | void sparse_init(void); | 588 | void sparse_init(void); |
| 573 | #else | 589 | #else |
| 574 | #define sparse_init() do {} while (0) | 590 | #define sparse_init() do {} while (0) |
| 591 | #define sparse_index_init(_sec, _nid) do {} while (0) | ||
| 575 | #endif /* CONFIG_SPARSEMEM */ | 592 | #endif /* CONFIG_SPARSEMEM */ |
| 576 | 593 | ||
| 577 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | 594 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index dce53ac1625d..47da39ba3f03 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Device tables which are exported to userspace via | 2 | * Device tables which are exported to userspace via |
| 3 | * scripts/table2alias.c. You must keep that file in sync with this | 3 | * scripts/mod/file2alias.c. You must keep that file in sync with this |
| 4 | * header. | 4 | * header. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -33,7 +33,8 @@ struct ieee1394_device_id { | |||
| 33 | __u32 model_id; | 33 | __u32 model_id; |
| 34 | __u32 specifier_id; | 34 | __u32 specifier_id; |
| 35 | __u32 version; | 35 | __u32 version; |
| 36 | kernel_ulong_t driver_data; | 36 | kernel_ulong_t driver_data |
| 37 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| 39 | 40 | ||
| @@ -182,9 +183,18 @@ struct of_device_id | |||
| 182 | char name[32]; | 183 | char name[32]; |
| 183 | char type[32]; | 184 | char type[32]; |
| 184 | char compatible[128]; | 185 | char compatible[128]; |
| 186 | #if __KERNEL__ | ||
| 185 | void *data; | 187 | void *data; |
| 188 | #else | ||
| 189 | kernel_ulong_t data; | ||
| 190 | #endif | ||
| 186 | }; | 191 | }; |
| 187 | 192 | ||
| 193 | /* VIO */ | ||
| 194 | struct vio_device_id { | ||
| 195 | char type[32]; | ||
| 196 | char compat[32]; | ||
| 197 | }; | ||
| 188 | 198 | ||
| 189 | /* PCMCIA */ | 199 | /* PCMCIA */ |
| 190 | 200 | ||
| @@ -208,7 +218,8 @@ struct pcmcia_device_id { | |||
| 208 | #ifdef __KERNEL__ | 218 | #ifdef __KERNEL__ |
| 209 | const char * prod_id[4]; | 219 | const char * prod_id[4]; |
| 210 | #else | 220 | #else |
| 211 | kernel_ulong_t prod_id[4]; | 221 | kernel_ulong_t prod_id[4] |
| 222 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 212 | #endif | 223 | #endif |
| 213 | 224 | ||
| 214 | /* not matched against */ | 225 | /* not matched against */ |
diff --git a/include/linux/mount.h b/include/linux/mount.h index 74b4727a4e30..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> |
| @@ -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/mv643xx.h b/include/linux/mv643xx.h index 5773ea42f6e4..0b08cd692201 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
| @@ -980,7 +980,7 @@ | |||
| 980 | /* I2C Registers */ | 980 | /* I2C Registers */ |
| 981 | /****************************************/ | 981 | /****************************************/ |
| 982 | 982 | ||
| 983 | #define MV64XXX_I2C_CTLR_NAME "mv64xxx i2c" | 983 | #define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c" |
| 984 | #define MV64XXX_I2C_OFFSET 0xc000 | 984 | #define MV64XXX_I2C_OFFSET 0xc000 |
| 985 | #define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 | 985 | #define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 |
| 986 | 986 | ||
diff --git a/include/linux/net.h b/include/linux/net.h index 20cb226b2268..4e981585a89a 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -84,6 +84,7 @@ enum sock_type { | |||
| 84 | SOCK_RAW = 3, | 84 | SOCK_RAW = 3, |
| 85 | SOCK_RDM = 4, | 85 | SOCK_RDM = 4, |
| 86 | SOCK_SEQPACKET = 5, | 86 | SOCK_SEQPACKET = 5, |
| 87 | SOCK_DCCP = 6, | ||
| 87 | SOCK_PACKET = 10, | 88 | SOCK_PACKET = 10, |
| 88 | }; | 89 | }; |
| 89 | 90 | ||
| @@ -282,5 +283,15 @@ static struct proto_ops name##_ops = { \ | |||
| 282 | #define MODULE_ALIAS_NETPROTO(proto) \ | 283 | #define MODULE_ALIAS_NETPROTO(proto) \ |
| 283 | MODULE_ALIAS("net-pf-" __stringify(proto)) | 284 | MODULE_ALIAS("net-pf-" __stringify(proto)) |
| 284 | 285 | ||
| 286 | #define MODULE_ALIAS_NET_PF_PROTO(pf, proto) \ | ||
| 287 | MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto)) | ||
| 288 | |||
| 289 | #ifdef CONFIG_SYSCTL | ||
| 290 | #include <linux/sysctl.h> | ||
| 291 | extern ctl_table net_table[]; | ||
| 292 | extern int net_msg_cost; | ||
| 293 | extern int net_msg_burst; | ||
| 294 | #endif | ||
| 295 | |||
| 285 | #endif /* __KERNEL__ */ | 296 | #endif /* __KERNEL__ */ |
| 286 | #endif /* _LINUX_NET_H */ | 297 | #endif /* _LINUX_NET_H */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a0ed7f9e801..7c717907896d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -244,6 +244,7 @@ struct netdev_boot_setup { | |||
| 244 | }; | 244 | }; |
| 245 | #define NETDEV_BOOT_SETUP_MAX 8 | 245 | #define NETDEV_BOOT_SETUP_MAX 8 |
| 246 | 246 | ||
| 247 | extern int __init netdev_boot_setup(char *str); | ||
| 247 | 248 | ||
| 248 | /* | 249 | /* |
| 249 | * The DEVICE structure. | 250 | * The DEVICE structure. |
| @@ -336,6 +337,7 @@ struct net_device | |||
| 336 | /* Interface address info. */ | 337 | /* Interface address info. */ |
| 337 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | 338 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ |
| 338 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ | 339 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ |
| 340 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | ||
| 339 | unsigned char addr_len; /* hardware address length */ | 341 | unsigned char addr_len; /* hardware address length */ |
| 340 | unsigned short dev_id; /* for shared network cards */ | 342 | unsigned short dev_id; /* for shared network cards */ |
| 341 | 343 | ||
| @@ -497,10 +499,12 @@ static inline void *netdev_priv(struct net_device *dev) | |||
| 497 | #define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) | 499 | #define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) |
| 498 | 500 | ||
| 499 | struct packet_type { | 501 | struct packet_type { |
| 500 | __be16 type; /* This is really htons(ether_type). */ | 502 | __be16 type; /* This is really htons(ether_type). */ |
| 501 | struct net_device *dev; /* NULL is wildcarded here */ | 503 | struct net_device *dev; /* NULL is wildcarded here */ |
| 502 | int (*func) (struct sk_buff *, struct net_device *, | 504 | int (*func) (struct sk_buff *, |
| 503 | struct packet_type *); | 505 | struct net_device *, |
| 506 | struct packet_type *, | ||
| 507 | struct net_device *); | ||
| 504 | void *af_packet_priv; | 508 | void *af_packet_priv; |
| 505 | struct list_head list; | 509 | struct list_head list; |
| 506 | }; | 510 | }; |
| @@ -671,6 +675,7 @@ extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); | |||
| 671 | extern void dev_init(void); | 675 | extern void dev_init(void); |
| 672 | 676 | ||
| 673 | extern int netdev_nit; | 677 | extern int netdev_nit; |
| 678 | extern int netdev_budget; | ||
| 674 | 679 | ||
| 675 | /* Called by rtnetlink.c:rtnl_unlock() */ | 680 | /* Called by rtnetlink.c:rtnl_unlock() */ |
| 676 | extern void netdev_run_todo(void); | 681 | extern void netdev_run_todo(void); |
| @@ -697,19 +702,9 @@ static inline int netif_carrier_ok(const struct net_device *dev) | |||
| 697 | 702 | ||
| 698 | extern void __netdev_watchdog_up(struct net_device *dev); | 703 | extern void __netdev_watchdog_up(struct net_device *dev); |
| 699 | 704 | ||
| 700 | static inline void netif_carrier_on(struct net_device *dev) | 705 | extern void netif_carrier_on(struct net_device *dev); |
| 701 | { | ||
| 702 | if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) | ||
| 703 | linkwatch_fire_event(dev); | ||
| 704 | if (netif_running(dev)) | ||
| 705 | __netdev_watchdog_up(dev); | ||
| 706 | } | ||
| 707 | 706 | ||
| 708 | static inline void netif_carrier_off(struct net_device *dev) | 707 | extern void netif_carrier_off(struct net_device *dev); |
| 709 | { | ||
| 710 | if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) | ||
| 711 | linkwatch_fire_event(dev); | ||
| 712 | } | ||
| 713 | 708 | ||
| 714 | /* Hot-plugging. */ | 709 | /* Hot-plugging. */ |
| 715 | static inline int netif_device_present(struct net_device *dev) | 710 | static inline int netif_device_present(struct net_device *dev) |
| @@ -916,6 +911,14 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward); | |||
| 916 | extern void net_enable_timestamp(void); | 911 | extern void net_enable_timestamp(void); |
| 917 | extern void net_disable_timestamp(void); | 912 | extern void net_disable_timestamp(void); |
| 918 | 913 | ||
| 914 | #ifdef CONFIG_PROC_FS | ||
| 915 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | ||
| 916 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
| 917 | extern void dev_seq_stop(struct seq_file *seq, void *v); | ||
| 918 | #endif | ||
| 919 | |||
| 920 | extern void linkwatch_run_queue(void); | ||
| 921 | |||
| 919 | #endif /* __KERNEL__ */ | 922 | #endif /* __KERNEL__ */ |
| 920 | 923 | ||
| 921 | #endif /* _LINUX_DEV_H */ | 924 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 2e2045482cb1..be365e70ee99 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -21,10 +21,23 @@ | |||
| 21 | #define NF_STOP 5 | 21 | #define NF_STOP 5 |
| 22 | #define NF_MAX_VERDICT NF_STOP | 22 | #define NF_MAX_VERDICT NF_STOP |
| 23 | 23 | ||
| 24 | /* we overload the higher bits for encoding auxiliary data such as the queue | ||
| 25 | * number. Not nice, but better than additional function arguments. */ | ||
| 26 | #define NF_VERDICT_MASK 0x0000ffff | ||
| 27 | #define NF_VERDICT_BITS 16 | ||
| 28 | |||
| 29 | #define NF_VERDICT_QMASK 0xffff0000 | ||
| 30 | #define NF_VERDICT_QBITS 16 | ||
| 31 | |||
| 32 | #define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE) | ||
| 33 | |||
| 34 | /* only for userspace compatibility */ | ||
| 35 | #ifndef __KERNEL__ | ||
| 24 | /* Generic cache responses from hook functions. | 36 | /* Generic cache responses from hook functions. |
| 25 | <= 0x2000 is used for protocol-flags. */ | 37 | <= 0x2000 is used for protocol-flags. */ |
| 26 | #define NFC_UNKNOWN 0x4000 | 38 | #define NFC_UNKNOWN 0x4000 |
| 27 | #define NFC_ALTERED 0x8000 | 39 | #define NFC_ALTERED 0x8000 |
| 40 | #endif | ||
| 28 | 41 | ||
| 29 | #ifdef __KERNEL__ | 42 | #ifdef __KERNEL__ |
| 30 | #include <linux/config.h> | 43 | #include <linux/config.h> |
| @@ -101,15 +114,51 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | |||
| 101 | 114 | ||
| 102 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; | 115 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; |
| 103 | 116 | ||
| 104 | typedef void nf_logfn(unsigned int hooknum, | 117 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will |
| 118 | * disappear once iptables is replaced with pkttables. Please DO NOT use them | ||
| 119 | * for any new code! */ | ||
| 120 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
| 121 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
| 122 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ | ||
| 123 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ | ||
| 124 | #define NF_LOG_MASK 0x0f | ||
| 125 | |||
| 126 | #define NF_LOG_TYPE_LOG 0x01 | ||
| 127 | #define NF_LOG_TYPE_ULOG 0x02 | ||
| 128 | |||
| 129 | struct nf_loginfo { | ||
| 130 | u_int8_t type; | ||
| 131 | union { | ||
| 132 | struct { | ||
| 133 | u_int32_t copy_len; | ||
| 134 | u_int16_t group; | ||
| 135 | u_int16_t qthreshold; | ||
| 136 | } ulog; | ||
| 137 | struct { | ||
| 138 | u_int8_t level; | ||
| 139 | u_int8_t logflags; | ||
| 140 | } log; | ||
| 141 | } u; | ||
| 142 | }; | ||
| 143 | |||
| 144 | typedef void nf_logfn(unsigned int pf, | ||
| 145 | unsigned int hooknum, | ||
| 105 | const struct sk_buff *skb, | 146 | const struct sk_buff *skb, |
| 106 | const struct net_device *in, | 147 | const struct net_device *in, |
| 107 | const struct net_device *out, | 148 | const struct net_device *out, |
| 149 | const struct nf_loginfo *li, | ||
| 108 | const char *prefix); | 150 | const char *prefix); |
| 109 | 151 | ||
| 152 | struct nf_logger { | ||
| 153 | struct module *me; | ||
| 154 | nf_logfn *logfn; | ||
| 155 | char *name; | ||
| 156 | }; | ||
| 157 | |||
| 110 | /* Function to register/unregister log function. */ | 158 | /* Function to register/unregister log function. */ |
| 111 | int nf_log_register(int pf, nf_logfn *logfn); | 159 | int nf_log_register(int pf, struct nf_logger *logger); |
| 112 | void nf_log_unregister(int pf, nf_logfn *logfn); | 160 | int nf_log_unregister_pf(int pf); |
| 161 | void nf_log_unregister_logger(struct nf_logger *logger); | ||
| 113 | 162 | ||
| 114 | /* Calls the registered backend logging function */ | 163 | /* Calls the registered backend logging function */ |
| 115 | void nf_log_packet(int pf, | 164 | void nf_log_packet(int pf, |
| @@ -117,6 +166,7 @@ void nf_log_packet(int pf, | |||
| 117 | const struct sk_buff *skb, | 166 | const struct sk_buff *skb, |
| 118 | const struct net_device *in, | 167 | const struct net_device *in, |
| 119 | const struct net_device *out, | 168 | const struct net_device *out, |
| 169 | struct nf_loginfo *li, | ||
| 120 | const char *fmt, ...); | 170 | const char *fmt, ...); |
| 121 | 171 | ||
| 122 | /* Activate hook; either okfn or kfree_skb called, unless a hook | 172 | /* Activate hook; either okfn or kfree_skb called, unless a hook |
| @@ -175,11 +225,16 @@ int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, | |||
| 175 | int *len); | 225 | int *len); |
| 176 | 226 | ||
| 177 | /* Packet queuing */ | 227 | /* Packet queuing */ |
| 178 | typedef int (*nf_queue_outfn_t)(struct sk_buff *skb, | 228 | struct nf_queue_handler { |
| 179 | struct nf_info *info, void *data); | 229 | int (*outfn)(struct sk_buff *skb, struct nf_info *info, |
| 230 | unsigned int queuenum, void *data); | ||
| 231 | void *data; | ||
| 232 | char *name; | ||
| 233 | }; | ||
| 180 | extern int nf_register_queue_handler(int pf, | 234 | extern int nf_register_queue_handler(int pf, |
| 181 | nf_queue_outfn_t outfn, void *data); | 235 | struct nf_queue_handler *qh); |
| 182 | extern int nf_unregister_queue_handler(int pf); | 236 | extern int nf_unregister_queue_handler(int pf); |
| 237 | extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh); | ||
| 183 | extern void nf_reinject(struct sk_buff *skb, | 238 | extern void nf_reinject(struct sk_buff *skb, |
| 184 | struct nf_info *info, | 239 | struct nf_info *info, |
| 185 | unsigned int verdict); | 240 | unsigned int verdict); |
| @@ -190,6 +245,27 @@ extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); | |||
| 190 | /* FIXME: Before cache is ever used, this must be implemented for real. */ | 245 | /* FIXME: Before cache is ever used, this must be implemented for real. */ |
| 191 | extern void nf_invalidate_cache(int pf); | 246 | extern void nf_invalidate_cache(int pf); |
| 192 | 247 | ||
| 248 | /* Call this before modifying an existing packet: ensures it is | ||
| 249 | modifiable and linear to the point you care about (writable_len). | ||
| 250 | Returns true or false. */ | ||
| 251 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); | ||
| 252 | |||
| 253 | struct nf_queue_rerouter { | ||
| 254 | void (*save)(const struct sk_buff *skb, struct nf_info *info); | ||
| 255 | int (*reroute)(struct sk_buff **skb, const struct nf_info *info); | ||
| 256 | int rer_size; | ||
| 257 | }; | ||
| 258 | |||
| 259 | #define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info)) | ||
| 260 | |||
| 261 | extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer); | ||
| 262 | extern int nf_unregister_queue_rerouter(int pf); | ||
| 263 | |||
| 264 | #ifdef CONFIG_PROC_FS | ||
| 265 | #include <linux/proc_fs.h> | ||
| 266 | extern struct proc_dir_entry *proc_net_netfilter; | ||
| 267 | #endif | ||
| 268 | |||
| 193 | #else /* !CONFIG_NETFILTER */ | 269 | #else /* !CONFIG_NETFILTER */ |
| 194 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) | 270 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
| 195 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 271 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h new file mode 100644 index 000000000000..1d5b10ae2399 --- /dev/null +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -0,0 +1,169 @@ | |||
| 1 | #ifndef _NFNETLINK_H | ||
| 2 | #define _NFNETLINK_H | ||
| 3 | #include <linux/types.h> | ||
| 4 | |||
| 5 | #ifndef __KERNEL__ | ||
| 6 | /* nfnetlink groups: Up to 32 maximum - backwards compatibility for userspace */ | ||
| 7 | #define NF_NETLINK_CONNTRACK_NEW 0x00000001 | ||
| 8 | #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 | ||
| 9 | #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 | ||
| 10 | #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 | ||
| 11 | #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 | ||
| 12 | #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 | ||
| 13 | #endif | ||
| 14 | |||
| 15 | enum nfnetlink_groups { | ||
| 16 | NFNLGRP_NONE, | ||
| 17 | #define NFNLGRP_NONE NFNLGRP_NONE | ||
| 18 | NFNLGRP_CONNTRACK_NEW, | ||
| 19 | #define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW | ||
| 20 | NFNLGRP_CONNTRACK_UPDATE, | ||
| 21 | #define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE | ||
| 22 | NFNLGRP_CONNTRACK_DESTROY, | ||
| 23 | #define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY | ||
| 24 | NFNLGRP_CONNTRACK_EXP_NEW, | ||
| 25 | #define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW | ||
| 26 | NFNLGRP_CONNTRACK_EXP_UPDATE, | ||
| 27 | #define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE | ||
| 28 | NFNLGRP_CONNTRACK_EXP_DESTROY, | ||
| 29 | #define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY | ||
| 30 | __NFNLGRP_MAX, | ||
| 31 | }; | ||
| 32 | #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) | ||
| 33 | |||
| 34 | /* Generic structure for encapsulation optional netfilter information. | ||
| 35 | * It is reminiscent of sockaddr, but with sa_family replaced | ||
| 36 | * with attribute type. | ||
| 37 | * ! This should someday be put somewhere generic as now rtnetlink and | ||
| 38 | * ! nfnetlink use the same attributes methods. - J. Schulist. | ||
| 39 | */ | ||
| 40 | |||
| 41 | struct nfattr | ||
| 42 | { | ||
| 43 | u_int16_t nfa_len; | ||
| 44 | u_int16_t nfa_type; | ||
| 45 | } __attribute__ ((packed)); | ||
| 46 | |||
| 47 | /* FIXME: Shamelessly copy and pasted from rtnetlink.h, it's time | ||
| 48 | * to put this in a generic file */ | ||
| 49 | |||
| 50 | #define NFA_ALIGNTO 4 | ||
| 51 | #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) | ||
| 52 | #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ | ||
| 53 | && (nfa)->nfa_len <= (len)) | ||
| 54 | #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ | ||
| 55 | (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) | ||
| 56 | #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) | ||
| 57 | #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) | ||
| 58 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | ||
| 59 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | ||
| 60 | #define NFA_NEST(skb, type) \ | ||
| 61 | ({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ | ||
| 62 | NFA_PUT(skb, type, 0, NULL); \ | ||
| 63 | __start; }) | ||
| 64 | #define NFA_NEST_END(skb, start) \ | ||
| 65 | ({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ | ||
| 66 | (skb)->len; }) | ||
| 67 | #define NFA_NEST_CANCEL(skb, start) \ | ||
| 68 | ({ if (start) \ | ||
| 69 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | ||
| 70 | -1; }) | ||
| 71 | |||
| 72 | /* General form of address family dependent message. | ||
| 73 | */ | ||
| 74 | struct nfgenmsg { | ||
| 75 | u_int8_t nfgen_family; /* AF_xxx */ | ||
| 76 | u_int8_t version; /* nfnetlink version */ | ||
| 77 | u_int16_t res_id; /* resource id */ | ||
| 78 | } __attribute__ ((packed)); | ||
| 79 | |||
| 80 | #define NFNETLINK_V0 0 | ||
| 81 | |||
| 82 | #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ | ||
| 83 | + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) | ||
| 84 | #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) | ||
| 85 | |||
| 86 | /* netfilter netlink message types are split in two pieces: | ||
| 87 | * 8 bit subsystem, 8bit operation. | ||
| 88 | */ | ||
| 89 | |||
| 90 | #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) | ||
| 91 | #define NFNL_MSG_TYPE(x) (x & 0x00ff) | ||
| 92 | |||
| 93 | /* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS() | ||
| 94 | * won't work anymore */ | ||
| 95 | #define NFNL_SUBSYS_NONE 0 | ||
| 96 | #define NFNL_SUBSYS_CTNETLINK 1 | ||
| 97 | #define NFNL_SUBSYS_CTNETLINK_EXP 2 | ||
| 98 | #define NFNL_SUBSYS_QUEUE 3 | ||
| 99 | #define NFNL_SUBSYS_ULOG 4 | ||
| 100 | #define NFNL_SUBSYS_COUNT 5 | ||
| 101 | |||
| 102 | #ifdef __KERNEL__ | ||
| 103 | |||
| 104 | #include <linux/netlink.h> | ||
| 105 | #include <linux/capability.h> | ||
| 106 | |||
| 107 | struct nfnl_callback | ||
| 108 | { | ||
| 109 | int (*call)(struct sock *nl, struct sk_buff *skb, | ||
| 110 | struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); | ||
| 111 | kernel_cap_t cap_required; /* capabilities required for this msg */ | ||
| 112 | u_int16_t attr_count; /* number of nfattr's */ | ||
| 113 | }; | ||
| 114 | |||
| 115 | struct nfnetlink_subsystem | ||
| 116 | { | ||
| 117 | const char *name; | ||
| 118 | __u8 subsys_id; /* nfnetlink subsystem ID */ | ||
| 119 | __u8 cb_count; /* number of callbacks */ | ||
| 120 | struct nfnl_callback *cb; /* callback for individual types */ | ||
| 121 | }; | ||
| 122 | |||
| 123 | extern void __nfa_fill(struct sk_buff *skb, int attrtype, | ||
| 124 | int attrlen, const void *data); | ||
| 125 | #define NFA_PUT(skb, attrtype, attrlen, data) \ | ||
| 126 | ({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ | ||
| 127 | __nfa_fill(skb, attrtype, attrlen, data); }) | ||
| 128 | |||
| 129 | extern struct semaphore nfnl_sem; | ||
| 130 | |||
| 131 | #define nfnl_shlock() down(&nfnl_sem) | ||
| 132 | #define nfnl_shlock_nowait() down_trylock(&nfnl_sem) | ||
| 133 | |||
| 134 | #define nfnl_shunlock() do { up(&nfnl_sem); \ | ||
| 135 | if(nfnl && nfnl->sk_receive_queue.qlen) \ | ||
| 136 | nfnl->sk_data_ready(nfnl, 0); \ | ||
| 137 | } while(0) | ||
| 138 | |||
| 139 | extern void nfnl_lock(void); | ||
| 140 | extern void nfnl_unlock(void); | ||
| 141 | |||
| 142 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | ||
| 143 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | ||
| 144 | |||
| 145 | extern int nfattr_parse(struct nfattr *tb[], int maxattr, | ||
| 146 | struct nfattr *nfa, int len); | ||
| 147 | |||
| 148 | #define nfattr_parse_nested(tb, max, nfa) \ | ||
| 149 | nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa))) | ||
| 150 | |||
| 151 | #define nfattr_bad_size(tb, max, cta_min) \ | ||
| 152 | ({ int __i, __res = 0; \ | ||
| 153 | for (__i=0; __i<max; __i++) \ | ||
| 154 | if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \ | ||
| 155 | __res = 1; \ | ||
| 156 | break; \ | ||
| 157 | } \ | ||
| 158 | __res; \ | ||
| 159 | }) | ||
| 160 | |||
| 161 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | ||
| 162 | int echo); | ||
| 163 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | ||
| 164 | |||
| 165 | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ | ||
| 166 | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) | ||
| 167 | |||
| 168 | #endif /* __KERNEL__ */ | ||
| 169 | #endif /* _NFNETLINK_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h new file mode 100644 index 000000000000..5c55751c78e4 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | #ifndef _IPCONNTRACK_NETLINK_H | ||
| 2 | #define _IPCONNTRACK_NETLINK_H | ||
| 3 | #include <linux/netfilter/nfnetlink.h> | ||
| 4 | |||
| 5 | enum cntl_msg_types { | ||
| 6 | IPCTNL_MSG_CT_NEW, | ||
| 7 | IPCTNL_MSG_CT_GET, | ||
| 8 | IPCTNL_MSG_CT_DELETE, | ||
| 9 | IPCTNL_MSG_CT_GET_CTRZERO, | ||
| 10 | |||
| 11 | IPCTNL_MSG_MAX | ||
| 12 | }; | ||
| 13 | |||
| 14 | enum ctnl_exp_msg_types { | ||
| 15 | IPCTNL_MSG_EXP_NEW, | ||
| 16 | IPCTNL_MSG_EXP_GET, | ||
| 17 | IPCTNL_MSG_EXP_DELETE, | ||
| 18 | |||
| 19 | IPCTNL_MSG_EXP_MAX | ||
| 20 | }; | ||
| 21 | |||
| 22 | |||
| 23 | enum ctattr_type { | ||
| 24 | CTA_UNSPEC, | ||
| 25 | CTA_TUPLE_ORIG, | ||
| 26 | CTA_TUPLE_REPLY, | ||
| 27 | CTA_STATUS, | ||
| 28 | CTA_PROTOINFO, | ||
| 29 | CTA_HELP, | ||
| 30 | CTA_NAT, | ||
| 31 | CTA_TIMEOUT, | ||
| 32 | CTA_MARK, | ||
| 33 | CTA_COUNTERS_ORIG, | ||
| 34 | CTA_COUNTERS_REPLY, | ||
| 35 | CTA_USE, | ||
| 36 | CTA_ID, | ||
| 37 | __CTA_MAX | ||
| 38 | }; | ||
| 39 | #define CTA_MAX (__CTA_MAX - 1) | ||
| 40 | |||
| 41 | enum ctattr_tuple { | ||
| 42 | CTA_TUPLE_UNSPEC, | ||
| 43 | CTA_TUPLE_IP, | ||
| 44 | CTA_TUPLE_PROTO, | ||
| 45 | __CTA_TUPLE_MAX | ||
| 46 | }; | ||
| 47 | #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) | ||
| 48 | |||
| 49 | enum ctattr_ip { | ||
| 50 | CTA_IP_UNSPEC, | ||
| 51 | CTA_IP_V4_SRC, | ||
| 52 | CTA_IP_V4_DST, | ||
| 53 | CTA_IP_V6_SRC, | ||
| 54 | CTA_IP_V6_DST, | ||
| 55 | __CTA_IP_MAX | ||
| 56 | }; | ||
| 57 | #define CTA_IP_MAX (__CTA_IP_MAX - 1) | ||
| 58 | |||
| 59 | enum ctattr_l4proto { | ||
| 60 | CTA_PROTO_UNSPEC, | ||
| 61 | CTA_PROTO_NUM, | ||
| 62 | CTA_PROTO_SRC_PORT, | ||
| 63 | CTA_PROTO_DST_PORT, | ||
| 64 | CTA_PROTO_ICMP_ID, | ||
| 65 | CTA_PROTO_ICMP_TYPE, | ||
| 66 | CTA_PROTO_ICMP_CODE, | ||
| 67 | __CTA_PROTO_MAX | ||
| 68 | }; | ||
| 69 | #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) | ||
| 70 | |||
| 71 | enum ctattr_protoinfo { | ||
| 72 | CTA_PROTOINFO_UNSPEC, | ||
| 73 | CTA_PROTOINFO_TCP_STATE, | ||
| 74 | __CTA_PROTOINFO_MAX | ||
| 75 | }; | ||
| 76 | #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) | ||
| 77 | |||
| 78 | enum ctattr_counters { | ||
| 79 | CTA_COUNTERS_UNSPEC, | ||
| 80 | CTA_COUNTERS_PACKETS, | ||
| 81 | CTA_COUNTERS_BYTES, | ||
| 82 | __CTA_COUNTERS_MAX | ||
| 83 | }; | ||
| 84 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) | ||
| 85 | |||
| 86 | enum ctattr_nat { | ||
| 87 | CTA_NAT_UNSPEC, | ||
| 88 | CTA_NAT_MINIP, | ||
| 89 | CTA_NAT_MAXIP, | ||
| 90 | CTA_NAT_PROTO, | ||
| 91 | __CTA_NAT_MAX | ||
| 92 | }; | ||
| 93 | #define CTA_NAT_MAX (__CTA_NAT_MAX - 1) | ||
| 94 | |||
| 95 | enum ctattr_protonat { | ||
| 96 | CTA_PROTONAT_UNSPEC, | ||
| 97 | CTA_PROTONAT_PORT_MIN, | ||
| 98 | CTA_PROTONAT_PORT_MAX, | ||
| 99 | __CTA_PROTONAT_MAX | ||
| 100 | }; | ||
| 101 | #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) | ||
| 102 | |||
| 103 | enum ctattr_expect { | ||
| 104 | CTA_EXPECT_UNSPEC, | ||
| 105 | CTA_EXPECT_MASTER, | ||
| 106 | CTA_EXPECT_TUPLE, | ||
| 107 | CTA_EXPECT_MASK, | ||
| 108 | CTA_EXPECT_TIMEOUT, | ||
| 109 | CTA_EXPECT_ID, | ||
| 110 | CTA_EXPECT_HELP_NAME, | ||
| 111 | __CTA_EXPECT_MAX | ||
| 112 | }; | ||
| 113 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | ||
| 114 | |||
| 115 | enum ctattr_help { | ||
| 116 | CTA_HELP_UNSPEC, | ||
| 117 | CTA_HELP_NAME, | ||
| 118 | __CTA_HELP_MAX | ||
| 119 | }; | ||
| 120 | #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) | ||
| 121 | |||
| 122 | #define CTA_HELP_MAXNAMESIZE 32 | ||
| 123 | |||
| 124 | #endif /* _IPCONNTRACK_NETLINK_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h new file mode 100644 index 000000000000..b04b03880595 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_log.h | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | #ifndef _NFNETLINK_LOG_H | ||
| 2 | #define _NFNETLINK_LOG_H | ||
| 3 | |||
| 4 | /* This file describes the netlink messages (i.e. 'protocol packets'), | ||
| 5 | * and not any kind of function definitions. It is shared between kernel and | ||
| 6 | * userspace. Don't put kernel specific stuff in here */ | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/netfilter/nfnetlink.h> | ||
| 10 | |||
| 11 | enum nfulnl_msg_types { | ||
| 12 | NFULNL_MSG_PACKET, /* packet from kernel to userspace */ | ||
| 13 | NFULNL_MSG_CONFIG, /* connect to a particular queue */ | ||
| 14 | |||
| 15 | NFULNL_MSG_MAX | ||
| 16 | }; | ||
| 17 | |||
| 18 | struct nfulnl_msg_packet_hdr { | ||
| 19 | u_int16_t hw_protocol; /* hw protocol (network order) */ | ||
| 20 | u_int8_t hook; /* netfilter hook */ | ||
| 21 | u_int8_t _pad; | ||
| 22 | } __attribute__ ((packed)); | ||
| 23 | |||
| 24 | struct nfulnl_msg_packet_hw { | ||
| 25 | u_int16_t hw_addrlen; | ||
| 26 | u_int16_t _pad; | ||
| 27 | u_int8_t hw_addr[8]; | ||
| 28 | } __attribute__ ((packed)); | ||
| 29 | |||
| 30 | struct nfulnl_msg_packet_timestamp { | ||
| 31 | aligned_u64 sec; | ||
| 32 | aligned_u64 usec; | ||
| 33 | } __attribute__ ((packed)); | ||
| 34 | |||
| 35 | #define NFULNL_PREFIXLEN 30 /* just like old log target */ | ||
| 36 | |||
| 37 | enum nfulnl_attr_type { | ||
| 38 | NFULA_UNSPEC, | ||
| 39 | NFULA_PACKET_HDR, | ||
| 40 | NFULA_MARK, /* u_int32_t nfmark */ | ||
| 41 | NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ | ||
| 42 | NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */ | ||
| 43 | NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ | ||
| 44 | NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ | ||
| 45 | NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ | ||
| 46 | NFULA_HWADDR, /* nfulnl_msg_packet_hw */ | ||
| 47 | NFULA_PAYLOAD, /* opaque data payload */ | ||
| 48 | NFULA_PREFIX, /* string prefix */ | ||
| 49 | NFULA_UID, /* user id of socket */ | ||
| 50 | |||
| 51 | __NFULA_MAX | ||
| 52 | }; | ||
| 53 | #define NFULA_MAX (__NFULA_MAX - 1) | ||
| 54 | |||
| 55 | enum nfulnl_msg_config_cmds { | ||
| 56 | NFULNL_CFG_CMD_NONE, | ||
| 57 | NFULNL_CFG_CMD_BIND, | ||
| 58 | NFULNL_CFG_CMD_UNBIND, | ||
| 59 | NFULNL_CFG_CMD_PF_BIND, | ||
| 60 | NFULNL_CFG_CMD_PF_UNBIND, | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct nfulnl_msg_config_cmd { | ||
| 64 | u_int8_t command; /* nfulnl_msg_config_cmds */ | ||
| 65 | } __attribute__ ((packed)); | ||
| 66 | |||
| 67 | struct nfulnl_msg_config_mode { | ||
| 68 | u_int32_t copy_range; | ||
| 69 | u_int8_t copy_mode; | ||
| 70 | u_int8_t _pad; | ||
| 71 | } __attribute__ ((packed)); | ||
| 72 | |||
| 73 | enum nfulnl_attr_config { | ||
| 74 | NFULA_CFG_UNSPEC, | ||
| 75 | NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ | ||
| 76 | NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ | ||
| 77 | NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */ | ||
| 78 | NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */ | ||
| 79 | NFULA_CFG_QTHRESH, /* u_int32_t */ | ||
| 80 | __NFULA_CFG_MAX | ||
| 81 | }; | ||
| 82 | #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) | ||
| 83 | |||
| 84 | #define NFULNL_COPY_NONE 0x00 | ||
| 85 | #define NFULNL_COPY_META 0x01 | ||
| 86 | #define NFULNL_COPY_PACKET 0x02 | ||
| 87 | |||
| 88 | #endif /* _NFNETLINK_LOG_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h new file mode 100644 index 000000000000..9e774373244c --- /dev/null +++ b/include/linux/netfilter/nfnetlink_queue.h | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #ifndef _NFNETLINK_QUEUE_H | ||
| 2 | #define _NFNETLINK_QUEUE_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <linux/netfilter/nfnetlink.h> | ||
| 6 | |||
| 7 | enum nfqnl_msg_types { | ||
| 8 | NFQNL_MSG_PACKET, /* packet from kernel to userspace */ | ||
| 9 | NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ | ||
| 10 | NFQNL_MSG_CONFIG, /* connect to a particular queue */ | ||
| 11 | |||
| 12 | NFQNL_MSG_MAX | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct nfqnl_msg_packet_hdr { | ||
| 16 | u_int32_t packet_id; /* unique ID of packet in queue */ | ||
| 17 | u_int16_t hw_protocol; /* hw protocol (network order) */ | ||
| 18 | u_int8_t hook; /* netfilter hook */ | ||
| 19 | } __attribute__ ((packed)); | ||
| 20 | |||
| 21 | struct nfqnl_msg_packet_hw { | ||
| 22 | u_int16_t hw_addrlen; | ||
| 23 | u_int16_t _pad; | ||
| 24 | u_int8_t hw_addr[8]; | ||
| 25 | } __attribute__ ((packed)); | ||
| 26 | |||
| 27 | struct nfqnl_msg_packet_timestamp { | ||
| 28 | aligned_u64 sec; | ||
| 29 | aligned_u64 usec; | ||
| 30 | } __attribute__ ((packed)); | ||
| 31 | |||
| 32 | enum nfqnl_attr_type { | ||
| 33 | NFQA_UNSPEC, | ||
| 34 | NFQA_PACKET_HDR, | ||
| 35 | NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ | ||
| 36 | NFQA_MARK, /* u_int32_t nfmark */ | ||
| 37 | NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ | ||
| 38 | NFQA_IFINDEX_INDEV, /* u_int32_t ifindex */ | ||
| 39 | NFQA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ | ||
| 40 | NFQA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ | ||
| 41 | NFQA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ | ||
| 42 | NFQA_HWADDR, /* nfqnl_msg_packet_hw */ | ||
| 43 | NFQA_PAYLOAD, /* opaque data payload */ | ||
| 44 | |||
| 45 | __NFQA_MAX | ||
| 46 | }; | ||
| 47 | #define NFQA_MAX (__NFQA_MAX - 1) | ||
| 48 | |||
| 49 | struct nfqnl_msg_verdict_hdr { | ||
| 50 | u_int32_t verdict; | ||
| 51 | u_int32_t id; | ||
| 52 | } __attribute__ ((packed)); | ||
| 53 | |||
| 54 | |||
| 55 | enum nfqnl_msg_config_cmds { | ||
| 56 | NFQNL_CFG_CMD_NONE, | ||
| 57 | NFQNL_CFG_CMD_BIND, | ||
| 58 | NFQNL_CFG_CMD_UNBIND, | ||
| 59 | NFQNL_CFG_CMD_PF_BIND, | ||
| 60 | NFQNL_CFG_CMD_PF_UNBIND, | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct nfqnl_msg_config_cmd { | ||
| 64 | u_int8_t command; /* nfqnl_msg_config_cmds */ | ||
| 65 | u_int8_t _pad; | ||
| 66 | u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ | ||
| 67 | } __attribute__ ((packed)); | ||
| 68 | |||
| 69 | enum nfqnl_config_mode { | ||
| 70 | NFQNL_COPY_NONE, | ||
| 71 | NFQNL_COPY_META, | ||
| 72 | NFQNL_COPY_PACKET, | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct nfqnl_msg_config_params { | ||
| 76 | u_int32_t copy_range; | ||
| 77 | u_int8_t copy_mode; /* enum nfqnl_config_mode */ | ||
| 78 | } __attribute__ ((packed)); | ||
| 79 | |||
| 80 | |||
| 81 | enum nfqnl_attr_config { | ||
| 82 | NFQA_CFG_UNSPEC, | ||
| 83 | NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ | ||
| 84 | NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ | ||
| 85 | __NFQA_CFG_MAX | ||
| 86 | }; | ||
| 87 | #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) | ||
| 88 | |||
| 89 | #endif /* _NFNETLINK_QUEUE_H */ | ||
diff --git a/include/linux/netfilter_decnet.h b/include/linux/netfilter_decnet.h index 3064eec9cb8e..6f425369ee29 100644 --- a/include/linux/netfilter_decnet.h +++ b/include/linux/netfilter_decnet.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/netfilter.h> | 10 | #include <linux/netfilter.h> |
| 11 | 11 | ||
| 12 | /* only for userspace compatibility */ | ||
| 13 | #ifndef __KERNEL__ | ||
| 12 | /* IP Cache bits. */ | 14 | /* IP Cache bits. */ |
| 13 | /* Src IP address. */ | 15 | /* Src IP address. */ |
| 14 | #define NFC_DN_SRC 0x0001 | 16 | #define NFC_DN_SRC 0x0001 |
| @@ -18,6 +20,7 @@ | |||
| 18 | #define NFC_DN_IF_IN 0x0004 | 20 | #define NFC_DN_IF_IN 0x0004 |
| 19 | /* Output device. */ | 21 | /* Output device. */ |
| 20 | #define NFC_DN_IF_OUT 0x0008 | 22 | #define NFC_DN_IF_OUT 0x0008 |
| 23 | #endif /* ! __KERNEL__ */ | ||
| 21 | 24 | ||
| 22 | /* DECnet Hooks */ | 25 | /* DECnet Hooks */ |
| 23 | /* After promisc drops, checksum checks. */ | 26 | /* After promisc drops, checksum checks. */ |
| @@ -53,7 +56,21 @@ struct nf_dn_rtmsg { | |||
| 53 | 56 | ||
| 54 | #define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) | 57 | #define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) |
| 55 | 58 | ||
| 59 | #ifndef __KERNEL__ | ||
| 60 | /* backwards compatibility for userspace */ | ||
| 56 | #define DNRMG_L1_GROUP 0x01 | 61 | #define DNRMG_L1_GROUP 0x01 |
| 57 | #define DNRMG_L2_GROUP 0x02 | 62 | #define DNRMG_L2_GROUP 0x02 |
| 63 | #endif | ||
| 64 | |||
| 65 | enum { | ||
| 66 | DNRNG_NLGRP_NONE, | ||
| 67 | #define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE | ||
| 68 | DNRNG_NLGRP_L1, | ||
| 69 | #define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1 | ||
| 70 | DNRNG_NLGRP_L2, | ||
| 71 | #define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2 | ||
| 72 | __DNRNG_NLGRP_MAX | ||
| 73 | }; | ||
| 74 | #define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1) | ||
| 58 | 75 | ||
| 59 | #endif /*__LINUX_DECNET_NETFILTER_H*/ | 76 | #endif /*__LINUX_DECNET_NETFILTER_H*/ |
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 3ebc36afae1a..fdc4a9527343 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include <linux/config.h> | 8 | #include <linux/config.h> |
| 9 | #include <linux/netfilter.h> | 9 | #include <linux/netfilter.h> |
| 10 | 10 | ||
| 11 | /* only for userspace compatibility */ | ||
| 12 | #ifndef __KERNEL__ | ||
| 11 | /* IP Cache bits. */ | 13 | /* IP Cache bits. */ |
| 12 | /* Src IP address. */ | 14 | /* Src IP address. */ |
| 13 | #define NFC_IP_SRC 0x0001 | 15 | #define NFC_IP_SRC 0x0001 |
| @@ -35,6 +37,7 @@ | |||
| 35 | #define NFC_IP_DST_PT 0x0400 | 37 | #define NFC_IP_DST_PT 0x0400 |
| 36 | /* Something else about the proto */ | 38 | /* Something else about the proto */ |
| 37 | #define NFC_IP_PROTO_UNKNOWN 0x2000 | 39 | #define NFC_IP_PROTO_UNKNOWN 0x2000 |
| 40 | #endif /* ! __KERNEL__ */ | ||
| 38 | 41 | ||
| 39 | /* IP Hooks */ | 42 | /* IP Hooks */ |
| 40 | /* After promisc drops, checksum checks. */ | 43 | /* After promisc drops, checksum checks. */ |
| @@ -77,11 +80,6 @@ enum nf_ip_hook_priorities { | |||
| 77 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
| 78 | extern int ip_route_me_harder(struct sk_buff **pskb); | 81 | extern int ip_route_me_harder(struct sk_buff **pskb); |
| 79 | 82 | ||
| 80 | /* Call this before modifying an existing IP packet: ensures it is | ||
| 81 | modifiable and linear to the point you care about (writable_len). | ||
| 82 | Returns true or false. */ | ||
| 83 | extern int skb_ip_make_writable(struct sk_buff **pskb, | ||
| 84 | unsigned int writable_len); | ||
| 85 | #endif /*__KERNEL__*/ | 83 | #endif /*__KERNEL__*/ |
| 86 | 84 | ||
| 87 | #endif /*__LINUX_IP_NETFILTER_H*/ | 85 | #endif /*__LINUX_IP_NETFILTER_H*/ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 3781192ce159..088742befe49 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h | |||
| @@ -65,6 +65,63 @@ enum ip_conntrack_status { | |||
| 65 | 65 | ||
| 66 | /* Both together */ | 66 | /* Both together */ |
| 67 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), | 67 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), |
| 68 | |||
| 69 | /* Connection is dying (removed from lists), can not be unset. */ | ||
| 70 | IPS_DYING_BIT = 9, | ||
| 71 | IPS_DYING = (1 << IPS_DYING_BIT), | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* Connection tracking event bits */ | ||
| 75 | enum ip_conntrack_events | ||
| 76 | { | ||
| 77 | /* New conntrack */ | ||
| 78 | IPCT_NEW_BIT = 0, | ||
| 79 | IPCT_NEW = (1 << IPCT_NEW_BIT), | ||
| 80 | |||
| 81 | /* Expected connection */ | ||
| 82 | IPCT_RELATED_BIT = 1, | ||
| 83 | IPCT_RELATED = (1 << IPCT_RELATED_BIT), | ||
| 84 | |||
| 85 | /* Destroyed conntrack */ | ||
| 86 | IPCT_DESTROY_BIT = 2, | ||
| 87 | IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), | ||
| 88 | |||
| 89 | /* Timer has been refreshed */ | ||
| 90 | IPCT_REFRESH_BIT = 3, | ||
| 91 | IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), | ||
| 92 | |||
| 93 | /* Status has changed */ | ||
| 94 | IPCT_STATUS_BIT = 4, | ||
| 95 | IPCT_STATUS = (1 << IPCT_STATUS_BIT), | ||
| 96 | |||
| 97 | /* Update of protocol info */ | ||
| 98 | IPCT_PROTOINFO_BIT = 5, | ||
| 99 | IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), | ||
| 100 | |||
| 101 | /* Volatile protocol info */ | ||
| 102 | IPCT_PROTOINFO_VOLATILE_BIT = 6, | ||
| 103 | IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), | ||
| 104 | |||
| 105 | /* New helper for conntrack */ | ||
| 106 | IPCT_HELPER_BIT = 7, | ||
| 107 | IPCT_HELPER = (1 << IPCT_HELPER_BIT), | ||
| 108 | |||
| 109 | /* Update of helper info */ | ||
| 110 | IPCT_HELPINFO_BIT = 8, | ||
| 111 | IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), | ||
| 112 | |||
| 113 | /* Volatile helper info */ | ||
| 114 | IPCT_HELPINFO_VOLATILE_BIT = 9, | ||
| 115 | IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), | ||
| 116 | |||
| 117 | /* NAT info */ | ||
| 118 | IPCT_NATINFO_BIT = 10, | ||
| 119 | IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), | ||
| 120 | }; | ||
| 121 | |||
| 122 | enum ip_conntrack_expect_events { | ||
| 123 | IPEXP_NEW_BIT = 0, | ||
| 124 | IPEXP_NEW = (1 << IPEXP_NEW_BIT), | ||
| 68 | }; | 125 | }; |
| 69 | 126 | ||
| 70 | #ifdef __KERNEL__ | 127 | #ifdef __KERNEL__ |
| @@ -152,6 +209,9 @@ struct ip_conntrack | |||
| 152 | /* Current number of expected connections */ | 209 | /* Current number of expected connections */ |
| 153 | unsigned int expecting; | 210 | unsigned int expecting; |
| 154 | 211 | ||
| 212 | /* Unique ID that identifies this conntrack*/ | ||
| 213 | unsigned int id; | ||
| 214 | |||
| 155 | /* Helper, if any. */ | 215 | /* Helper, if any. */ |
| 156 | struct ip_conntrack_helper *helper; | 216 | struct ip_conntrack_helper *helper; |
| 157 | 217 | ||
| @@ -171,7 +231,7 @@ struct ip_conntrack | |||
| 171 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ | 231 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ |
| 172 | 232 | ||
| 173 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | 233 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
| 174 | unsigned long mark; | 234 | u_int32_t mark; |
| 175 | #endif | 235 | #endif |
| 176 | 236 | ||
| 177 | /* Traversed often, so hopefully in different cacheline to top */ | 237 | /* Traversed often, so hopefully in different cacheline to top */ |
| @@ -197,6 +257,12 @@ struct ip_conntrack_expect | |||
| 197 | /* Timer function; deletes the expectation. */ | 257 | /* Timer function; deletes the expectation. */ |
| 198 | struct timer_list timeout; | 258 | struct timer_list timeout; |
| 199 | 259 | ||
| 260 | /* Usage count. */ | ||
| 261 | atomic_t use; | ||
| 262 | |||
| 263 | /* Unique ID */ | ||
| 264 | unsigned int id; | ||
| 265 | |||
| 200 | #ifdef CONFIG_IP_NF_NAT_NEEDED | 266 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 201 | /* This is the original per-proto part, used to map the | 267 | /* This is the original per-proto part, used to map the |
| 202 | * expected connection the way the recipient expects. */ | 268 | * expected connection the way the recipient expects. */ |
| @@ -236,7 +302,12 @@ ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) | |||
| 236 | } | 302 | } |
| 237 | 303 | ||
| 238 | /* decrement reference count on a conntrack */ | 304 | /* decrement reference count on a conntrack */ |
| 239 | extern inline void ip_conntrack_put(struct ip_conntrack *ct); | 305 | static inline void |
| 306 | ip_conntrack_put(struct ip_conntrack *ct) | ||
| 307 | { | ||
| 308 | IP_NF_ASSERT(ct); | ||
| 309 | nf_conntrack_put(&ct->ct_general); | ||
| 310 | } | ||
| 240 | 311 | ||
| 241 | /* call to create an explicit dependency on ip_conntrack. */ | 312 | /* call to create an explicit dependency on ip_conntrack. */ |
| 242 | extern void need_ip_conntrack(void); | 313 | extern void need_ip_conntrack(void); |
| @@ -271,12 +342,50 @@ extern void | |||
| 271 | ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data), | 342 | ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data), |
| 272 | void *data); | 343 | void *data); |
| 273 | 344 | ||
| 345 | extern struct ip_conntrack_helper * | ||
| 346 | __ip_conntrack_helper_find_byname(const char *); | ||
| 347 | extern struct ip_conntrack_helper * | ||
| 348 | ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple); | ||
| 349 | extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper); | ||
| 350 | |||
| 351 | extern struct ip_conntrack_protocol * | ||
| 352 | __ip_conntrack_proto_find(u_int8_t protocol); | ||
| 353 | extern struct ip_conntrack_protocol * | ||
| 354 | ip_conntrack_proto_find_get(u_int8_t protocol); | ||
| 355 | extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto); | ||
| 356 | |||
| 357 | extern void ip_ct_remove_expectations(struct ip_conntrack *ct); | ||
| 358 | |||
| 359 | extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *, | ||
| 360 | struct ip_conntrack_tuple *); | ||
| 361 | |||
| 362 | extern void ip_conntrack_free(struct ip_conntrack *ct); | ||
| 363 | |||
| 364 | extern void ip_conntrack_hash_insert(struct ip_conntrack *ct); | ||
| 365 | |||
| 366 | extern struct ip_conntrack_expect * | ||
| 367 | __ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); | ||
| 368 | |||
| 369 | extern struct ip_conntrack_expect * | ||
| 370 | ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple); | ||
| 371 | |||
| 372 | extern struct ip_conntrack_tuple_hash * | ||
| 373 | __ip_conntrack_find(const struct ip_conntrack_tuple *tuple, | ||
| 374 | const struct ip_conntrack *ignored_conntrack); | ||
| 375 | |||
| 376 | extern void ip_conntrack_flush(void); | ||
| 377 | |||
| 274 | /* It's confirmed if it is, or has been in the hash table. */ | 378 | /* It's confirmed if it is, or has been in the hash table. */ |
| 275 | static inline int is_confirmed(struct ip_conntrack *ct) | 379 | static inline int is_confirmed(struct ip_conntrack *ct) |
| 276 | { | 380 | { |
| 277 | return test_bit(IPS_CONFIRMED_BIT, &ct->status); | 381 | return test_bit(IPS_CONFIRMED_BIT, &ct->status); |
| 278 | } | 382 | } |
| 279 | 383 | ||
| 384 | static inline int is_dying(struct ip_conntrack *ct) | ||
| 385 | { | ||
| 386 | return test_bit(IPS_DYING_BIT, &ct->status); | ||
| 387 | } | ||
| 388 | |||
| 280 | extern unsigned int ip_conntrack_htable_size; | 389 | extern unsigned int ip_conntrack_htable_size; |
| 281 | 390 | ||
| 282 | struct ip_conntrack_stat | 391 | struct ip_conntrack_stat |
| @@ -300,6 +409,85 @@ struct ip_conntrack_stat | |||
| 300 | 409 | ||
| 301 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) | 410 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) |
| 302 | 411 | ||
| 412 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS | ||
| 413 | #include <linux/notifier.h> | ||
| 414 | #include <linux/interrupt.h> | ||
| 415 | |||
| 416 | struct ip_conntrack_ecache { | ||
| 417 | struct ip_conntrack *ct; | ||
| 418 | unsigned int events; | ||
| 419 | }; | ||
| 420 | DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache); | ||
| 421 | |||
| 422 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x) | ||
| 423 | |||
| 424 | extern struct notifier_block *ip_conntrack_chain; | ||
| 425 | extern struct notifier_block *ip_conntrack_expect_chain; | ||
| 426 | |||
| 427 | static inline int ip_conntrack_register_notifier(struct notifier_block *nb) | ||
| 428 | { | ||
| 429 | return notifier_chain_register(&ip_conntrack_chain, nb); | ||
| 430 | } | ||
| 431 | |||
| 432 | static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb) | ||
| 433 | { | ||
| 434 | return notifier_chain_unregister(&ip_conntrack_chain, nb); | ||
| 435 | } | ||
| 436 | |||
| 437 | static inline int | ||
| 438 | ip_conntrack_expect_register_notifier(struct notifier_block *nb) | ||
| 439 | { | ||
| 440 | return notifier_chain_register(&ip_conntrack_expect_chain, nb); | ||
| 441 | } | ||
| 442 | |||
| 443 | static inline int | ||
| 444 | ip_conntrack_expect_unregister_notifier(struct notifier_block *nb) | ||
| 445 | { | ||
| 446 | return notifier_chain_unregister(&ip_conntrack_expect_chain, nb); | ||
| 447 | } | ||
| 448 | |||
| 449 | extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct); | ||
| 450 | extern void __ip_ct_event_cache_init(struct ip_conntrack *ct); | ||
| 451 | |||
| 452 | static inline void | ||
| 453 | ip_conntrack_event_cache(enum ip_conntrack_events event, | ||
| 454 | const struct sk_buff *skb) | ||
| 455 | { | ||
| 456 | struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct; | ||
| 457 | struct ip_conntrack_ecache *ecache; | ||
| 458 | |||
| 459 | local_bh_disable(); | ||
| 460 | ecache = &__get_cpu_var(ip_conntrack_ecache); | ||
| 461 | if (ct != ecache->ct) | ||
| 462 | __ip_ct_event_cache_init(ct); | ||
| 463 | ecache->events |= event; | ||
| 464 | local_bh_enable(); | ||
| 465 | } | ||
| 466 | |||
| 467 | static inline void ip_conntrack_event(enum ip_conntrack_events event, | ||
| 468 | struct ip_conntrack *ct) | ||
| 469 | { | ||
| 470 | if (is_confirmed(ct) && !is_dying(ct)) | ||
| 471 | notifier_call_chain(&ip_conntrack_chain, event, ct); | ||
| 472 | } | ||
| 473 | |||
| 474 | static inline void | ||
| 475 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
| 476 | struct ip_conntrack_expect *exp) | ||
| 477 | { | ||
| 478 | notifier_call_chain(&ip_conntrack_expect_chain, event, exp); | ||
| 479 | } | ||
| 480 | #else /* CONFIG_IP_NF_CONNTRACK_EVENTS */ | ||
| 481 | static inline void ip_conntrack_event_cache(enum ip_conntrack_events event, | ||
| 482 | const struct sk_buff *skb) {} | ||
| 483 | static inline void ip_conntrack_event(enum ip_conntrack_events event, | ||
| 484 | struct ip_conntrack *ct) {} | ||
| 485 | static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {} | ||
| 486 | static inline void | ||
| 487 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
| 488 | struct ip_conntrack_expect *exp) {} | ||
| 489 | #endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */ | ||
| 490 | |||
| 303 | #ifdef CONFIG_IP_NF_NAT_NEEDED | 491 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
| 304 | static inline int ip_nat_initialized(struct ip_conntrack *conntrack, | 492 | static inline int ip_nat_initialized(struct ip_conntrack *conntrack, |
| 305 | enum ip_nat_manip_type manip) | 493 | enum ip_nat_manip_type manip) |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h index 694aec9b4784..dc4d2a0575de 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | #define _IP_CONNTRACK_CORE_H | 2 | #define _IP_CONNTRACK_CORE_H |
| 3 | #include <linux/netfilter.h> | 3 | #include <linux/netfilter.h> |
| 4 | 4 | ||
| 5 | #define MAX_IP_CT_PROTO 256 | ||
| 6 | extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; | ||
| 7 | |||
| 5 | /* This header is used to share core functionality between the | 8 | /* This header is used to share core functionality between the |
| 6 | standalone connection tracking module, and the compatibility layer's use | 9 | standalone connection tracking module, and the compatibility layer's use |
| 7 | of connection tracking. */ | 10 | of connection tracking. */ |
| @@ -38,12 +41,19 @@ extern int __ip_conntrack_confirm(struct sk_buff **pskb); | |||
| 38 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | 41 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ |
| 39 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) | 42 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) |
| 40 | { | 43 | { |
| 41 | if ((*pskb)->nfct | 44 | struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct; |
| 42 | && !is_confirmed((struct ip_conntrack *)(*pskb)->nfct)) | 45 | int ret = NF_ACCEPT; |
| 43 | return __ip_conntrack_confirm(pskb); | 46 | |
| 44 | return NF_ACCEPT; | 47 | if (ct) { |
| 48 | if (!is_confirmed(ct)) | ||
| 49 | ret = __ip_conntrack_confirm(pskb); | ||
| 50 | ip_ct_deliver_cached_events(ct); | ||
| 51 | } | ||
| 52 | return ret; | ||
| 45 | } | 53 | } |
| 46 | 54 | ||
| 55 | extern void __ip_ct_expect_unlink_destroy(struct ip_conntrack_expect *exp); | ||
| 56 | |||
| 47 | extern struct list_head *ip_conntrack_hash; | 57 | extern struct list_head *ip_conntrack_hash; |
| 48 | extern struct list_head ip_conntrack_expect_list; | 58 | extern struct list_head ip_conntrack_expect_list; |
| 49 | extern rwlock_t ip_conntrack_lock; | 59 | extern rwlock_t ip_conntrack_lock; |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h index b1bbba0a12cb..8d69279ccfe4 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h | |||
| @@ -24,15 +24,18 @@ struct ip_conntrack_helper | |||
| 24 | int (*help)(struct sk_buff **pskb, | 24 | int (*help)(struct sk_buff **pskb, |
| 25 | struct ip_conntrack *ct, | 25 | struct ip_conntrack *ct, |
| 26 | enum ip_conntrack_info conntrackinfo); | 26 | enum ip_conntrack_info conntrackinfo); |
| 27 | |||
| 28 | int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); | ||
| 27 | }; | 29 | }; |
| 28 | 30 | ||
| 29 | extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); | 31 | extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); |
| 30 | extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *); | 32 | extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *); |
| 31 | 33 | ||
| 32 | /* Allocate space for an expectation: this is mandatory before calling | 34 | /* Allocate space for an expectation: this is mandatory before calling |
| 33 | ip_conntrack_expect_related. */ | 35 | ip_conntrack_expect_related. You will have to call put afterwards. */ |
| 34 | extern struct ip_conntrack_expect *ip_conntrack_expect_alloc(void); | 36 | extern struct ip_conntrack_expect * |
| 35 | extern void ip_conntrack_expect_free(struct ip_conntrack_expect *exp); | 37 | ip_conntrack_expect_alloc(struct ip_conntrack *master); |
| 38 | extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp); | ||
| 36 | 39 | ||
| 37 | /* Add an expected connection: can have more than one per connection */ | 40 | /* Add an expected connection: can have more than one per connection */ |
| 38 | extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); | 41 | extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h index e20b57c5e1b7..b6b99be8632a 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #ifndef _IP_CONNTRACK_PROTOCOL_H | 2 | #ifndef _IP_CONNTRACK_PROTOCOL_H |
| 3 | #define _IP_CONNTRACK_PROTOCOL_H | 3 | #define _IP_CONNTRACK_PROTOCOL_H |
| 4 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 4 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
| 5 | #include <linux/netfilter/nfnetlink_conntrack.h> | ||
| 5 | 6 | ||
| 6 | struct seq_file; | 7 | struct seq_file; |
| 7 | 8 | ||
| @@ -47,22 +48,22 @@ struct ip_conntrack_protocol | |||
| 47 | int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | 48 | int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, |
| 48 | unsigned int hooknum); | 49 | unsigned int hooknum); |
| 49 | 50 | ||
| 51 | /* convert protoinfo to nfnetink attributes */ | ||
| 52 | int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa, | ||
| 53 | const struct ip_conntrack *ct); | ||
| 54 | |||
| 55 | int (*tuple_to_nfattr)(struct sk_buff *skb, | ||
| 56 | const struct ip_conntrack_tuple *t); | ||
| 57 | int (*nfattr_to_tuple)(struct nfattr *tb[], | ||
| 58 | struct ip_conntrack_tuple *t); | ||
| 59 | |||
| 50 | /* Module (if any) which this is connected to. */ | 60 | /* Module (if any) which this is connected to. */ |
| 51 | struct module *me; | 61 | struct module *me; |
| 52 | }; | 62 | }; |
| 53 | 63 | ||
| 54 | #define MAX_IP_CT_PROTO 256 | ||
| 55 | extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; | ||
| 56 | |||
| 57 | /* Protocol registration. */ | 64 | /* Protocol registration. */ |
| 58 | extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); | 65 | extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); |
| 59 | extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); | 66 | extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); |
| 60 | |||
| 61 | static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) | ||
| 62 | { | ||
| 63 | return ip_ct_protos[protocol]; | ||
| 64 | } | ||
| 65 | |||
| 66 | /* Existing built-in protocols */ | 67 | /* Existing built-in protocols */ |
| 67 | extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; | 68 | extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; |
| 68 | extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; | 69 | extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; |
| @@ -73,6 +74,11 @@ extern int ip_conntrack_protocol_tcp_init(void); | |||
| 73 | /* Log invalid packets */ | 74 | /* Log invalid packets */ |
| 74 | extern unsigned int ip_ct_log_invalid; | 75 | extern unsigned int ip_ct_log_invalid; |
| 75 | 76 | ||
| 77 | extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *, | ||
| 78 | const struct ip_conntrack_tuple *); | ||
| 79 | extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[], | ||
| 80 | struct ip_conntrack_tuple *); | ||
| 81 | |||
| 76 | #ifdef CONFIG_SYSCTL | 82 | #ifdef CONFIG_SYSCTL |
| 77 | #ifdef DEBUG_INVALID_PACKETS | 83 | #ifdef DEBUG_INVALID_PACKETS |
| 78 | #define LOG_INVALID(proto) \ | 84 | #define LOG_INVALID(proto) \ |
diff --git a/include/linux/netfilter_ipv4/ip_logging.h b/include/linux/netfilter_ipv4/ip_logging.h deleted file mode 100644 index 0c5c52cb6589..000000000000 --- a/include/linux/netfilter_ipv4/ip_logging.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | /* IPv4 macros for the internal logging interface. */ | ||
| 2 | #ifndef __IP_LOGGING_H | ||
| 3 | #define __IP_LOGGING_H | ||
| 4 | |||
| 5 | #ifdef __KERNEL__ | ||
| 6 | #include <linux/socket.h> | ||
| 7 | #include <linux/netfilter_logging.h> | ||
| 8 | |||
| 9 | #define nf_log_ip_packet(pskb,hooknum,in,out,fmt,args...) \ | ||
| 10 | nf_log_packet(AF_INET,pskb,hooknum,in,out,fmt,##args) | ||
| 11 | |||
| 12 | #define nf_log_ip(pfh,len,fmt,args...) \ | ||
| 13 | nf_log(AF_INET,pfh,len,fmt,##args) | ||
| 14 | |||
| 15 | #define nf_ip_log_register(logging) nf_log_register(AF_INET,logging) | ||
| 16 | #define nf_ip_log_unregister(logging) nf_log_unregister(AF_INET,logging) | ||
| 17 | |||
| 18 | #endif /*__KERNEL__*/ | ||
| 19 | |||
| 20 | #endif /*__IP_LOGGING_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h index 129708c22386..ef63aa991a06 100644 --- a/include/linux/netfilter_ipv4/ip_nat_protocol.h +++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
| 5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
| 6 | 6 | ||
| 7 | #include <linux/netfilter_ipv4/ip_nat.h> | ||
| 8 | #include <linux/netfilter/nfnetlink_conntrack.h> | ||
| 9 | |||
| 7 | struct iphdr; | 10 | struct iphdr; |
| 8 | struct ip_nat_range; | 11 | struct ip_nat_range; |
| 9 | 12 | ||
| @@ -15,6 +18,8 @@ struct ip_nat_protocol | |||
| 15 | /* Protocol number. */ | 18 | /* Protocol number. */ |
| 16 | unsigned int protonum; | 19 | unsigned int protonum; |
| 17 | 20 | ||
| 21 | struct module *me; | ||
| 22 | |||
| 18 | /* Translate a packet to the target according to manip type. | 23 | /* Translate a packet to the target according to manip type. |
| 19 | Return true if succeeded. */ | 24 | Return true if succeeded. */ |
| 20 | int (*manip_pkt)(struct sk_buff **pskb, | 25 | int (*manip_pkt)(struct sk_buff **pskb, |
| @@ -43,19 +48,20 @@ struct ip_nat_protocol | |||
| 43 | 48 | ||
| 44 | unsigned int (*print_range)(char *buffer, | 49 | unsigned int (*print_range)(char *buffer, |
| 45 | const struct ip_nat_range *range); | 50 | const struct ip_nat_range *range); |
| 46 | }; | ||
| 47 | 51 | ||
| 48 | #define MAX_IP_NAT_PROTO 256 | 52 | int (*range_to_nfattr)(struct sk_buff *skb, |
| 49 | extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; | 53 | const struct ip_nat_range *range); |
| 54 | |||
| 55 | int (*nfattr_to_range)(struct nfattr *tb[], | ||
| 56 | struct ip_nat_range *range); | ||
| 57 | }; | ||
| 50 | 58 | ||
| 51 | /* Protocol registration. */ | 59 | /* Protocol registration. */ |
| 52 | extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); | 60 | extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); |
| 53 | extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); | 61 | extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); |
| 54 | 62 | ||
| 55 | static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol) | 63 | extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol); |
| 56 | { | 64 | extern void ip_nat_proto_put(struct ip_nat_protocol *proto); |
| 57 | return ip_nat_protos[protocol]; | ||
| 58 | } | ||
| 59 | 65 | ||
| 60 | /* Built-in protocols. */ | 66 | /* Built-in protocols. */ |
| 61 | extern struct ip_nat_protocol ip_nat_protocol_tcp; | 67 | extern struct ip_nat_protocol ip_nat_protocol_tcp; |
| @@ -67,4 +73,9 @@ extern int init_protocols(void) __init; | |||
| 67 | extern void cleanup_protocols(void); | 73 | extern void cleanup_protocols(void); |
| 68 | extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum); | 74 | extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum); |
| 69 | 75 | ||
| 76 | extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb, | ||
| 77 | const struct ip_nat_range *range); | ||
| 78 | extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[], | ||
| 79 | struct ip_nat_range *range); | ||
| 80 | |||
| 70 | #endif /*_IP_NAT_PROTO_H*/ | 81 | #endif /*_IP_NAT_PROTO_H*/ |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index 12ce47808e7d..d19d65cf4530 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
| @@ -109,7 +109,8 @@ struct ipt_counters | |||
| 109 | 109 | ||
| 110 | /* Values for "flag" field in struct ipt_ip (general ip structure). */ | 110 | /* Values for "flag" field in struct ipt_ip (general ip structure). */ |
| 111 | #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ | 111 | #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ |
| 112 | #define IPT_F_MASK 0x01 /* All possible flag bits mask. */ | 112 | #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ |
| 113 | #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ | ||
| 113 | 114 | ||
| 114 | /* Values for "inv" field in struct ipt_ip. */ | 115 | /* Values for "inv" field in struct ipt_ip. */ |
| 115 | #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ | 116 | #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ |
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h index d25f782e57d1..22d16177319b 100644 --- a/include/linux/netfilter_ipv4/ipt_LOG.h +++ b/include/linux/netfilter_ipv4/ipt_LOG.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _IPT_LOG_H | 1 | #ifndef _IPT_LOG_H |
| 2 | #define _IPT_LOG_H | 2 | #define _IPT_LOG_H |
| 3 | 3 | ||
| 4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | ||
| 4 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 5 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 5 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ | 6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ |
| 6 | #define IPT_LOG_IPOPT 0x04 /* Log IP options */ | 7 | #define IPT_LOG_IPOPT 0x04 /* Log IP options */ |
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h new file mode 100644 index 000000000000..b5b2943b0c66 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* iptables module for using NFQUEUE mechanism | ||
| 2 | * | ||
| 3 | * (C) 2005 Harald Welte <laforge@netfilter.org> | ||
| 4 | * | ||
| 5 | * This software is distributed under GNU GPL v2, 1991 | ||
| 6 | * | ||
| 7 | */ | ||
| 8 | #ifndef _IPT_NFQ_TARGET_H | ||
| 9 | #define _IPT_NFQ_TARGET_H | ||
| 10 | |||
| 11 | /* target info */ | ||
| 12 | struct ipt_NFQ_info { | ||
| 13 | u_int16_t queuenum; | ||
| 14 | }; | ||
| 15 | |||
| 16 | #endif /* _IPT_DSCP_TARGET_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h new file mode 100644 index 000000000000..ee6611edc112 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_TTL.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* TTL modification module for IP tables | ||
| 2 | * (C) 2000 by Harald Welte <laforge@netfilter.org> */ | ||
| 3 | |||
| 4 | #ifndef _IPT_TTL_H | ||
| 5 | #define _IPT_TTL_H | ||
| 6 | |||
| 7 | enum { | ||
| 8 | IPT_TTL_SET = 0, | ||
| 9 | IPT_TTL_INC, | ||
| 10 | IPT_TTL_DEC | ||
| 11 | }; | ||
| 12 | |||
| 13 | #define IPT_TTL_MAXMODE IPT_TTL_DEC | ||
| 14 | |||
| 15 | struct ipt_TTL_info { | ||
| 16 | u_int8_t mode; | ||
| 17 | u_int8_t ttl; | ||
| 18 | }; | ||
| 19 | |||
| 20 | |||
| 21 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h new file mode 100644 index 000000000000..9e5532f8d8ac --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_connbytes.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef _IPT_CONNBYTES_H | ||
| 2 | #define _IPT_CONNBYTES_H | ||
| 3 | |||
| 4 | enum ipt_connbytes_what { | ||
| 5 | IPT_CONNBYTES_PKTS, | ||
| 6 | IPT_CONNBYTES_BYTES, | ||
| 7 | IPT_CONNBYTES_AVGPKT, | ||
| 8 | }; | ||
| 9 | |||
| 10 | enum ipt_connbytes_direction { | ||
| 11 | IPT_CONNBYTES_DIR_ORIGINAL, | ||
| 12 | IPT_CONNBYTES_DIR_REPLY, | ||
| 13 | IPT_CONNBYTES_DIR_BOTH, | ||
| 14 | }; | ||
| 15 | |||
| 16 | struct ipt_connbytes_info | ||
| 17 | { | ||
| 18 | struct { | ||
| 19 | aligned_u64 from; /* count to be matched */ | ||
| 20 | aligned_u64 to; /* count to be matched */ | ||
| 21 | } count; | ||
| 22 | u_int8_t what; /* ipt_connbytes_what */ | ||
| 23 | u_int8_t direction; /* ipt_connbytes_direction */ | ||
| 24 | }; | ||
| 25 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h new file mode 100644 index 000000000000..3cb3a522e62b --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_dccp.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef _IPT_DCCP_H_ | ||
| 2 | #define _IPT_DCCP_H_ | ||
| 3 | |||
| 4 | #define IPT_DCCP_SRC_PORTS 0x01 | ||
| 5 | #define IPT_DCCP_DEST_PORTS 0x02 | ||
| 6 | #define IPT_DCCP_TYPE 0x04 | ||
| 7 | #define IPT_DCCP_OPTION 0x08 | ||
| 8 | |||
| 9 | #define IPT_DCCP_VALID_FLAGS 0x0f | ||
| 10 | |||
| 11 | struct ipt_dccp_info { | ||
| 12 | u_int16_t dpts[2]; /* Min, Max */ | ||
| 13 | u_int16_t spts[2]; /* Min, Max */ | ||
| 14 | |||
| 15 | u_int16_t flags; | ||
| 16 | u_int16_t invflags; | ||
| 17 | |||
| 18 | u_int16_t typemask; | ||
| 19 | u_int8_t option; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #endif /* _IPT_DCCP_H_ */ | ||
| 23 | |||
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h new file mode 100644 index 000000000000..a265f6e44eab --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_string.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef _IPT_STRING_H | ||
| 2 | #define _IPT_STRING_H | ||
| 3 | |||
| 4 | #define IPT_STRING_MAX_PATTERN_SIZE 128 | ||
| 5 | #define IPT_STRING_MAX_ALGO_NAME_SIZE 16 | ||
| 6 | |||
| 7 | struct ipt_string_info | ||
| 8 | { | ||
| 9 | u_int16_t from_offset; | ||
| 10 | u_int16_t to_offset; | ||
| 11 | char algo[IPT_STRING_MAX_ALGO_NAME_SIZE]; | ||
| 12 | char pattern[IPT_STRING_MAX_PATTERN_SIZE]; | ||
| 13 | u_int8_t patlen; | ||
| 14 | u_int8_t invert; | ||
| 15 | struct ts_config __attribute__((aligned(8))) *config; | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif /*_IPT_STRING_H*/ | ||
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index bee7a5ec7c66..edcc2c6eb5c7 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/netfilter.h> | 11 | #include <linux/netfilter.h> |
| 12 | 12 | ||
| 13 | /* only for userspace compatibility */ | ||
| 14 | #ifndef __KERNEL__ | ||
| 13 | /* IP Cache bits. */ | 15 | /* IP Cache bits. */ |
| 14 | /* Src IP address. */ | 16 | /* Src IP address. */ |
| 15 | #define NFC_IP6_SRC 0x0001 | 17 | #define NFC_IP6_SRC 0x0001 |
| @@ -38,6 +40,7 @@ | |||
| 38 | #define NFC_IP6_DST_PT 0x0400 | 40 | #define NFC_IP6_DST_PT 0x0400 |
| 39 | /* Something else about the proto */ | 41 | /* Something else about the proto */ |
| 40 | #define NFC_IP6_PROTO_UNKNOWN 0x2000 | 42 | #define NFC_IP6_PROTO_UNKNOWN 0x2000 |
| 43 | #endif /* ! __KERNEL__ */ | ||
| 41 | 44 | ||
| 42 | 45 | ||
| 43 | /* IP6 Hooks */ | 46 | /* IP6 Hooks */ |
| @@ -68,4 +71,7 @@ enum nf_ip6_hook_priorities { | |||
| 68 | NF_IP6_PRI_LAST = INT_MAX, | 71 | NF_IP6_PRI_LAST = INT_MAX, |
| 69 | }; | 72 | }; |
| 70 | 73 | ||
| 74 | extern int ipv6_netfilter_init(void); | ||
| 75 | extern void ipv6_netfilter_fini(void); | ||
| 76 | |||
| 71 | #endif /*__LINUX_IP6_NETFILTER_H*/ | 77 | #endif /*__LINUX_IP6_NETFILTER_H*/ |
diff --git a/include/linux/netfilter_ipv6/ip6_logging.h b/include/linux/netfilter_ipv6/ip6_logging.h deleted file mode 100644 index a0b2ee3043aa..000000000000 --- a/include/linux/netfilter_ipv6/ip6_logging.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | /* IPv6 macros for the nternal logging interface. */ | ||
| 2 | #ifndef __IP6_LOGGING_H | ||
| 3 | #define __IP6_LOGGING_H | ||
| 4 | |||
| 5 | #ifdef __KERNEL__ | ||
| 6 | #include <linux/socket.h> | ||
| 7 | #include <linux/netfilter_logging.h> | ||
| 8 | |||
| 9 | #define nf_log_ip6_packet(pskb,hooknum,in,out,fmt,args...) \ | ||
| 10 | nf_log_packet(AF_INET6,pskb,hooknum,in,out,fmt,##args) | ||
| 11 | |||
| 12 | #define nf_log_ip6(pfh,len,fmt,args...) \ | ||
| 13 | nf_log(AF_INET6,pfh,len,fmt,##args) | ||
| 14 | |||
| 15 | #define nf_ip6_log_register(logging) nf_log_register(AF_INET6,logging) | ||
| 16 | #define nf_ip6_log_unregister(logging) nf_log_unregister(AF_INET6,logging) | ||
| 17 | |||
| 18 | #endif /*__KERNEL__*/ | ||
| 19 | |||
| 20 | #endif /*__IP6_LOGGING_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index f1ce3b009853..58c72a52dc65 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
| @@ -111,7 +111,8 @@ struct ip6t_counters | |||
| 111 | #define IP6T_F_PROTO 0x01 /* Set if rule cares about upper | 111 | #define IP6T_F_PROTO 0x01 /* Set if rule cares about upper |
| 112 | protocols */ | 112 | protocols */ |
| 113 | #define IP6T_F_TOS 0x02 /* Match the TOS. */ | 113 | #define IP6T_F_TOS 0x02 /* Match the TOS. */ |
| 114 | #define IP6T_F_MASK 0x03 /* All possible flag bits mask. */ | 114 | #define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ |
| 115 | #define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ | ||
| 115 | 116 | ||
| 116 | /* Values for "inv" field in struct ip6t_ip6. */ | 117 | /* Values for "inv" field in struct ip6t_ip6. */ |
| 117 | #define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ | 118 | #define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h new file mode 100644 index 000000000000..afb7813d45ab --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_HL.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* Hop Limit modification module for ip6tables | ||
| 2 | * Maciej Soltysiak <solt@dns.toxicfilms.tv> | ||
| 3 | * Based on HW's TTL module */ | ||
| 4 | |||
| 5 | #ifndef _IP6T_HL_H | ||
| 6 | #define _IP6T_HL_H | ||
| 7 | |||
| 8 | enum { | ||
| 9 | IP6T_HL_SET = 0, | ||
| 10 | IP6T_HL_INC, | ||
| 11 | IP6T_HL_DEC | ||
| 12 | }; | ||
| 13 | |||
| 14 | #define IP6T_HL_MAXMODE IP6T_HL_DEC | ||
| 15 | |||
| 16 | struct ip6t_HL_info { | ||
| 17 | u_int8_t mode; | ||
| 18 | u_int8_t hop_limit; | ||
| 19 | }; | ||
| 20 | |||
| 21 | |||
| 22 | #endif | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h index 42996a43bb39..9008ff5c40ae 100644 --- a/include/linux/netfilter_ipv6/ip6t_LOG.h +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _IP6T_LOG_H | 1 | #ifndef _IP6T_LOG_H |
| 2 | #define _IP6T_LOG_H | 2 | #define _IP6T_LOG_H |
| 3 | 3 | ||
| 4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | ||
| 4 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 5 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 5 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ | 6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ |
| 6 | #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ | 7 | #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h new file mode 100644 index 000000000000..6be6504162bb --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef _IP6T_REJECT_H | ||
| 2 | #define _IP6T_REJECT_H | ||
| 3 | |||
| 4 | enum ip6t_reject_with { | ||
| 5 | IP6T_ICMP6_NO_ROUTE, | ||
| 6 | IP6T_ICMP6_ADM_PROHIBITED, | ||
| 7 | IP6T_ICMP6_NOT_NEIGHBOUR, | ||
| 8 | IP6T_ICMP6_ADDR_UNREACH, | ||
| 9 | IP6T_ICMP6_PORT_UNREACH, | ||
| 10 | IP6T_ICMP6_ECHOREPLY, | ||
| 11 | IP6T_TCP_RESET | ||
| 12 | }; | ||
| 13 | |||
| 14 | struct ip6t_reject_info { | ||
| 15 | u_int32_t with; /* reject type */ | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif /*_IP6T_REJECT_H*/ | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 27e4d164a108..167518668936 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -5,21 +5,20 @@ | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | 6 | ||
| 7 | #define NETLINK_ROUTE 0 /* Routing/device hook */ | 7 | #define NETLINK_ROUTE 0 /* Routing/device hook */ |
| 8 | #define NETLINK_SKIP 1 /* Reserved for ENskip */ | 8 | #define NETLINK_W1 1 /* 1-wire subsystem */ |
| 9 | #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ | 9 | #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ |
| 10 | #define NETLINK_FIREWALL 3 /* Firewalling hook */ | 10 | #define NETLINK_FIREWALL 3 /* Firewalling hook */ |
| 11 | #define NETLINK_TCPDIAG 4 /* TCP socket monitoring */ | 11 | #define NETLINK_INET_DIAG 4 /* INET socket monitoring */ |
| 12 | #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ | 12 | #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ |
| 13 | #define NETLINK_XFRM 6 /* ipsec */ | 13 | #define NETLINK_XFRM 6 /* ipsec */ |
| 14 | #define NETLINK_SELINUX 7 /* SELinux event notifications */ | 14 | #define NETLINK_SELINUX 7 /* SELinux event notifications */ |
| 15 | #define NETLINK_ARPD 8 | 15 | #define NETLINK_ISCSI 8 /* Open-iSCSI */ |
| 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_NETFILTER 12 /* netfilter subsystem */ |
| 19 | #define NETLINK_IP6_FW 13 | 19 | #define NETLINK_IP6_FW 13 |
| 20 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 20 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ |
| 21 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ | 21 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ |
| 22 | #define NETLINK_TAPBASE 16 /* 16 to 31 are ethertap */ | ||
| 23 | 22 | ||
| 24 | #define MAX_LINKS 32 | 23 | #define MAX_LINKS 32 |
| 25 | 24 | ||
| @@ -91,6 +90,15 @@ struct nlmsgerr | |||
| 91 | struct nlmsghdr msg; | 90 | struct nlmsghdr msg; |
| 92 | }; | 91 | }; |
| 93 | 92 | ||
| 93 | #define NETLINK_ADD_MEMBERSHIP 1 | ||
| 94 | #define NETLINK_DROP_MEMBERSHIP 2 | ||
| 95 | #define NETLINK_PKTINFO 3 | ||
| 96 | |||
| 97 | struct nl_pktinfo | ||
| 98 | { | ||
| 99 | __u32 group; | ||
| 100 | }; | ||
| 101 | |||
| 94 | #define NET_MAJOR 36 /* Major 36 is reserved for networking */ | 102 | #define NET_MAJOR 36 /* Major 36 is reserved for networking */ |
| 95 | 103 | ||
| 96 | enum { | 104 | enum { |
| @@ -107,9 +115,8 @@ struct netlink_skb_parms | |||
| 107 | { | 115 | { |
| 108 | struct ucred creds; /* Skb credentials */ | 116 | struct ucred creds; /* Skb credentials */ |
| 109 | __u32 pid; | 117 | __u32 pid; |
| 110 | __u32 groups; | ||
| 111 | __u32 dst_pid; | 118 | __u32 dst_pid; |
| 112 | __u32 dst_groups; | 119 | __u32 dst_group; |
| 113 | kernel_cap_t eff_cap; | 120 | kernel_cap_t eff_cap; |
| 114 | __u32 loginuid; /* Login (audit) uid */ | 121 | __u32 loginuid; /* Login (audit) uid */ |
| 115 | }; | 122 | }; |
| @@ -118,11 +125,11 @@ struct netlink_skb_parms | |||
| 118 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) | 125 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) |
| 119 | 126 | ||
| 120 | 127 | ||
| 121 | extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len)); | 128 | extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); |
| 122 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 129 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
| 123 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); | 130 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); |
| 124 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, | 131 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, |
| 125 | __u32 group, int allocation); | 132 | __u32 group, unsigned int __nocast allocation); |
| 126 | extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); | 133 | extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); |
| 127 | extern int netlink_register_notifier(struct notifier_block *nb); | 134 | extern int netlink_register_notifier(struct notifier_block *nb); |
| 128 | extern int netlink_unregister_notifier(struct notifier_block *nb); | 135 | extern int netlink_unregister_notifier(struct notifier_block *nb); |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index bcd0ac33f592..5ade54a78dbb 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/rcupdate.h> | ||
| 12 | #include <linux/list.h> | 13 | #include <linux/list.h> |
| 13 | 14 | ||
| 14 | struct netpoll; | 15 | struct netpoll; |
| @@ -26,6 +27,7 @@ struct netpoll { | |||
| 26 | struct netpoll_info { | 27 | struct netpoll_info { |
| 27 | spinlock_t poll_lock; | 28 | spinlock_t poll_lock; |
| 28 | int poll_owner; | 29 | int poll_owner; |
| 30 | int tries; | ||
| 29 | int rx_flags; | 31 | int rx_flags; |
| 30 | spinlock_t rx_lock; | 32 | spinlock_t rx_lock; |
| 31 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 33 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ |
| @@ -60,25 +62,31 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
| 60 | return ret; | 62 | return ret; |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | static inline void netpoll_poll_lock(struct net_device *dev) | 65 | static inline void *netpoll_poll_lock(struct net_device *dev) |
| 64 | { | 66 | { |
| 67 | rcu_read_lock(); /* deal with race on ->npinfo */ | ||
| 65 | if (dev->npinfo) { | 68 | if (dev->npinfo) { |
| 66 | spin_lock(&dev->npinfo->poll_lock); | 69 | spin_lock(&dev->npinfo->poll_lock); |
| 67 | dev->npinfo->poll_owner = smp_processor_id(); | 70 | dev->npinfo->poll_owner = smp_processor_id(); |
| 71 | return dev->npinfo; | ||
| 68 | } | 72 | } |
| 73 | return NULL; | ||
| 69 | } | 74 | } |
| 70 | 75 | ||
| 71 | static inline void netpoll_poll_unlock(struct net_device *dev) | 76 | static inline void netpoll_poll_unlock(void *have) |
| 72 | { | 77 | { |
| 73 | if (dev->npinfo) { | 78 | struct netpoll_info *npi = have; |
| 74 | dev->npinfo->poll_owner = -1; | 79 | |
| 75 | spin_unlock(&dev->npinfo->poll_lock); | 80 | if (npi) { |
| 81 | npi->poll_owner = -1; | ||
| 82 | spin_unlock(&npi->poll_lock); | ||
| 76 | } | 83 | } |
| 84 | rcu_read_unlock(); | ||
| 77 | } | 85 | } |
| 78 | 86 | ||
| 79 | #else | 87 | #else |
| 80 | #define netpoll_rx(a) 0 | 88 | #define netpoll_rx(a) 0 |
| 81 | #define netpoll_poll_lock(a) | 89 | #define netpoll_poll_lock(a) 0 |
| 82 | #define netpoll_poll_unlock(a) | 90 | #define netpoll_poll_unlock(a) |
| 83 | #endif | 91 | #endif |
| 84 | 92 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 8ea249110fb0..9a6047ff1b25 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -112,7 +112,8 @@ struct nfs_inode { | |||
| 112 | /* | 112 | /* |
| 113 | * Various flags | 113 | * Various flags |
| 114 | */ | 114 | */ |
| 115 | unsigned int flags; | 115 | unsigned long flags; /* atomic bit ops */ |
| 116 | unsigned long cache_validity; /* bit mask */ | ||
| 116 | 117 | ||
| 117 | /* | 118 | /* |
| 118 | * read_cache_jiffies is when we started read-caching this inode, | 119 | * read_cache_jiffies is when we started read-caching this inode, |
| @@ -174,8 +175,6 @@ struct nfs_inode { | |||
| 174 | /* Open contexts for shared mmap writes */ | 175 | /* Open contexts for shared mmap writes */ |
| 175 | struct list_head open_files; | 176 | struct list_head open_files; |
| 176 | 177 | ||
| 177 | wait_queue_head_t nfs_i_wait; | ||
| 178 | |||
| 179 | #ifdef CONFIG_NFS_V4 | 178 | #ifdef CONFIG_NFS_V4 |
| 180 | struct nfs4_cached_acl *nfs4_acl; | 179 | struct nfs4_cached_acl *nfs4_acl; |
| 181 | /* NFSv4 state */ | 180 | /* NFSv4 state */ |
| @@ -188,17 +187,21 @@ struct nfs_inode { | |||
| 188 | }; | 187 | }; |
| 189 | 188 | ||
| 190 | /* | 189 | /* |
| 191 | * Legal inode flag values | 190 | * Cache validity bit flags |
| 192 | */ | 191 | */ |
| 193 | #define NFS_INO_STALE 0x0001 /* possible stale inode */ | 192 | #define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */ |
| 194 | #define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ | 193 | #define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */ |
| 195 | #define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ | 194 | #define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */ |
| 196 | #define NFS_INO_INVALID_ATTR 0x0008 /* cached attrs are invalid */ | 195 | #define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */ |
| 197 | #define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ | 196 | #define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ |
| 198 | #define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ | 197 | #define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ |
| 199 | #define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ | 198 | |
| 200 | #define NFS_INO_INVALID_ACL 0x0080 /* cached acls are invalid */ | 199 | /* |
| 201 | #define NFS_INO_REVAL_PAGECACHE 0x1000 /* must revalidate pagecache */ | 200 | * Bit offsets in flags field |
| 201 | */ | ||
| 202 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ | ||
| 203 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ | ||
| 204 | #define NFS_INO_STALE (2) /* possible stale inode */ | ||
| 202 | 205 | ||
| 203 | static inline struct nfs_inode *NFS_I(struct inode *inode) | 206 | static inline struct nfs_inode *NFS_I(struct inode *inode) |
| 204 | { | 207 | { |
| @@ -224,8 +227,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) | |||
| 224 | #define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) | 227 | #define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) |
| 225 | 228 | ||
| 226 | #define NFS_FLAGS(inode) (NFS_I(inode)->flags) | 229 | #define NFS_FLAGS(inode) (NFS_I(inode)->flags) |
| 227 | #define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) | 230 | #define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) |
| 228 | #define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE) | ||
| 229 | 231 | ||
| 230 | #define NFS_FILEID(inode) (NFS_I(inode)->fileid) | 232 | #define NFS_FILEID(inode) (NFS_I(inode)->fileid) |
| 231 | 233 | ||
| @@ -236,8 +238,11 @@ static inline int nfs_caches_unstable(struct inode *inode) | |||
| 236 | 238 | ||
| 237 | static inline void NFS_CACHEINV(struct inode *inode) | 239 | static inline void NFS_CACHEINV(struct inode *inode) |
| 238 | { | 240 | { |
| 239 | if (!nfs_caches_unstable(inode)) | 241 | if (!nfs_caches_unstable(inode)) { |
| 240 | NFS_FLAGS(inode) |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | 242 | spin_lock(&inode->i_lock); |
| 243 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | ||
| 244 | spin_unlock(&inode->i_lock); | ||
| 245 | } | ||
| 241 | } | 246 | } |
| 242 | 247 | ||
| 243 | static inline int nfs_server_capable(struct inode *inode, int cap) | 248 | static inline int nfs_server_capable(struct inode *inode, int cap) |
| @@ -247,7 +252,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap) | |||
| 247 | 252 | ||
| 248 | static inline int NFS_USE_READDIRPLUS(struct inode *inode) | 253 | static inline int NFS_USE_READDIRPLUS(struct inode *inode) |
| 249 | { | 254 | { |
| 250 | return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS; | 255 | return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); |
| 251 | } | 256 | } |
| 252 | 257 | ||
| 253 | /** | 258 | /** |
| @@ -292,6 +297,7 @@ extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | |||
| 292 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 297 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
| 293 | extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 298 | extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
| 294 | extern int nfs_setattr(struct dentry *, struct iattr *); | 299 | extern int nfs_setattr(struct dentry *, struct iattr *); |
| 300 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | ||
| 295 | extern void nfs_begin_attr_update(struct inode *); | 301 | extern void nfs_begin_attr_update(struct inode *); |
| 296 | extern void nfs_end_attr_update(struct inode *); | 302 | extern void nfs_end_attr_update(struct inode *); |
| 297 | extern void nfs_begin_data_update(struct inode *); | 303 | extern void nfs_begin_data_update(struct inode *); |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f5a6695d4d21..f34767c5fc79 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -134,6 +134,7 @@ struct page_state { | |||
| 134 | }; | 134 | }; |
| 135 | 135 | ||
| 136 | extern void get_page_state(struct page_state *ret); | 136 | extern void get_page_state(struct page_state *ret); |
| 137 | extern void get_page_state_node(struct page_state *ret, int node); | ||
| 137 | extern void get_full_page_state(struct page_state *ret); | 138 | extern void get_full_page_state(struct page_state *ret); |
| 138 | extern unsigned long __read_page_state(unsigned long offset); | 139 | extern unsigned long __read_page_state(unsigned long offset); |
| 139 | extern void __mod_page_state(unsigned long offset, unsigned long delta); | 140 | extern void __mod_page_state(unsigned long offset, unsigned long delta); |
| @@ -194,6 +195,7 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta); | |||
| 194 | #define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) | 195 | #define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) |
| 195 | #define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags) | 196 | #define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags) |
| 196 | #define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags) | 197 | #define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags) |
| 198 | #define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags) | ||
| 197 | #define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) | 199 | #define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) |
| 198 | 200 | ||
| 199 | #define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) | 201 | #define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7ac14961ba22..bc4c40000c0d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -556,7 +556,8 @@ struct pci_dev { | |||
| 556 | /* keep track of device state */ | 556 | /* keep track of device state */ |
| 557 | unsigned int is_enabled:1; /* pci_enable_device has been called */ | 557 | unsigned int is_enabled:1; /* pci_enable_device has been called */ |
| 558 | unsigned int is_busmaster:1; /* device is busmaster */ | 558 | unsigned int is_busmaster:1; /* device is busmaster */ |
| 559 | 559 | unsigned int no_msi:1; /* device may not use msi */ | |
| 560 | |||
| 560 | u32 saved_config_space[16]; /* config space saved at suspend time */ | 561 | u32 saved_config_space[16]; /* config space saved at suspend time */ |
| 561 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ | 562 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ |
| 562 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ | 563 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ |
| @@ -971,6 +972,8 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en | |||
| 971 | 972 | ||
| 972 | #define isa_bridge ((struct pci_dev *)NULL) | 973 | #define isa_bridge ((struct pci_dev *)NULL) |
| 973 | 974 | ||
| 975 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | ||
| 976 | |||
| 974 | #else | 977 | #else |
| 975 | 978 | ||
| 976 | /* | 979 | /* |
| @@ -985,9 +988,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
| 985 | return 0; | 988 | return 0; |
| 986 | } | 989 | } |
| 987 | #endif | 990 | #endif |
| 988 | |||
| 989 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | ||
| 990 | |||
| 991 | #endif /* !CONFIG_PCI */ | 991 | #endif /* !CONFIG_PCI */ |
| 992 | 992 | ||
| 993 | /* these helpers provide future and backwards compatibility | 993 | /* these helpers provide future and backwards compatibility |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 27348c22dacb..95c941f8c747 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -881,7 +881,7 @@ | |||
| 881 | #define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e | 881 | #define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e |
| 882 | #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 | 882 | #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 |
| 883 | #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 | 883 | #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 |
| 884 | #define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 | 884 | #define PCI_DEVICE_ID_APPLE_UNI_N_ATA 0x0033 |
| 885 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 | 885 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 |
| 886 | #define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b | 886 | #define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b |
| 887 | #define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e | 887 | #define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e |
| @@ -911,6 +911,15 @@ | |||
| 911 | #define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 | 911 | #define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 |
| 912 | #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 | 912 | #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 |
| 913 | #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 | 913 | #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 |
| 914 | #define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 | ||
| 915 | #define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312 | ||
| 916 | #define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 | ||
| 917 | #define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312 | ||
| 918 | #define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322 | ||
| 919 | #define PCI_DEVICE_ID_QLOGIC_ISP2422 0x2422 | ||
| 920 | #define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 | ||
| 921 | #define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 | ||
| 922 | #define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 | ||
| 914 | 923 | ||
| 915 | #define PCI_VENDOR_ID_CYRIX 0x1078 | 924 | #define PCI_VENDOR_ID_CYRIX 0x1078 |
| 916 | #define PCI_DEVICE_ID_CYRIX_5510 0x0000 | 925 | #define PCI_DEVICE_ID_CYRIX_5510 0x0000 |
| @@ -1011,6 +1020,7 @@ | |||
| 1011 | #define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 | 1020 | #define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 |
| 1012 | #define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 | 1021 | #define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 |
| 1013 | #define PCI_DEVICE_ID_PLX_R753 0x1152 | 1022 | #define PCI_DEVICE_ID_PLX_R753 0x1152 |
| 1023 | #define PCI_DEVICE_ID_PLX_OLITEC 0x1187 | ||
| 1014 | #define PCI_DEVICE_ID_PLX_9030 0x9030 | 1024 | #define PCI_DEVICE_ID_PLX_9030 0x9030 |
| 1015 | #define PCI_DEVICE_ID_PLX_9050 0x9050 | 1025 | #define PCI_DEVICE_ID_PLX_9050 0x9050 |
| 1016 | #define PCI_DEVICE_ID_PLX_9060 0x9060 | 1026 | #define PCI_DEVICE_ID_PLX_9060 0x9060 |
| @@ -1239,6 +1249,7 @@ | |||
| 1239 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 | 1249 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 |
| 1240 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 | 1250 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 |
| 1241 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E | 1251 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E |
| 1252 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x036F | ||
| 1242 | #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 | 1253 | #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 |
| 1243 | #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 | 1254 | #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 |
| 1244 | #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B | 1255 | #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B |
| @@ -1570,6 +1581,7 @@ | |||
| 1570 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 | 1581 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 |
| 1571 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 | 1582 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 |
| 1572 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 | 1583 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 |
| 1584 | #define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 | ||
| 1573 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 | 1585 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 |
| 1574 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 | 1586 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 |
| 1575 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB | 1587 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB |
| @@ -1872,6 +1884,7 @@ | |||
| 1872 | #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 | 1884 | #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 |
| 1873 | 1885 | ||
| 1874 | #define PCI_VENDOR_ID_SIIG 0x131f | 1886 | #define PCI_VENDOR_ID_SIIG 0x131f |
| 1887 | #define PCI_SUBVENDOR_ID_SIIG 0x131f | ||
| 1875 | #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 | 1888 | #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 |
| 1876 | #define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 | 1889 | #define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 |
| 1877 | #define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 | 1890 | #define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 |
| @@ -1909,6 +1922,7 @@ | |||
| 1909 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 | 1922 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 |
| 1910 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 | 1923 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 |
| 1911 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 | 1924 | #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 |
| 1925 | #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 | ||
| 1912 | 1926 | ||
| 1913 | #define PCI_VENDOR_ID_RADISYS 0x1331 | 1927 | #define PCI_VENDOR_ID_RADISYS 0x1331 |
| 1914 | #define PCI_DEVICE_ID_RADISYS_ENP2611 0x0030 | 1928 | #define PCI_DEVICE_ID_RADISYS_ENP2611 0x0030 |
| @@ -2096,6 +2110,8 @@ | |||
| 2096 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 | 2110 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 |
| 2097 | #define PCI_DEVICE_ID_TIGON3_5705M 0x165d | 2111 | #define PCI_DEVICE_ID_TIGON3_5705M 0x165d |
| 2098 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e | 2112 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e |
| 2113 | #define PCI_DEVICE_ID_TIGON3_5780 0x166a | ||
| 2114 | #define PCI_DEVICE_ID_TIGON3_5780S 0x166b | ||
| 2099 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e | 2115 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e |
| 2100 | #define PCI_DEVICE_ID_TIGON3_5750 0x1676 | 2116 | #define PCI_DEVICE_ID_TIGON3_5750 0x1676 |
| 2101 | #define PCI_DEVICE_ID_TIGON3_5751 0x1677 | 2117 | #define PCI_DEVICE_ID_TIGON3_5751 0x1677 |
| @@ -2129,6 +2145,10 @@ | |||
| 2129 | #define PCI_DEVICE_ID_ENE_1225 0x1225 | 2145 | #define PCI_DEVICE_ID_ENE_1225 0x1225 |
| 2130 | #define PCI_DEVICE_ID_ENE_1410 0x1410 | 2146 | #define PCI_DEVICE_ID_ENE_1410 0x1410 |
| 2131 | #define PCI_DEVICE_ID_ENE_1420 0x1420 | 2147 | #define PCI_DEVICE_ID_ENE_1420 0x1420 |
| 2148 | #define PCI_VENDOR_ID_CHELSIO 0x1425 | ||
| 2149 | |||
| 2150 | #define PCI_VENDOR_ID_MIPS 0x153f | ||
| 2151 | #define PCI_DEVICE_ID_SOC_IT 0x0001 | ||
| 2132 | 2152 | ||
| 2133 | #define PCI_VENDOR_ID_SYBA 0x1592 | 2153 | #define PCI_VENDOR_ID_SYBA 0x1592 |
| 2134 | #define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 | 2154 | #define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 |
| @@ -2170,6 +2190,9 @@ | |||
| 2170 | #define PCI_VENDOR_ID_SIBYTE 0x166d | 2190 | #define PCI_VENDOR_ID_SIBYTE 0x166d |
| 2171 | #define PCI_DEVICE_ID_BCM1250_HT 0x0002 | 2191 | #define PCI_DEVICE_ID_BCM1250_HT 0x0002 |
| 2172 | 2192 | ||
| 2193 | #define PCI_VENDOR_ID_NETCELL 0x169c | ||
| 2194 | #define PCI_DEVICE_ID_REVOLUTION 0x0044 | ||
| 2195 | |||
| 2173 | #define PCI_VENDOR_ID_LINKSYS 0x1737 | 2196 | #define PCI_VENDOR_ID_LINKSYS 0x1737 |
| 2174 | #define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032 | 2197 | #define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032 |
| 2175 | #define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 | 2198 | #define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 |
| @@ -2267,6 +2290,11 @@ | |||
| 2267 | #define PCI_VENDOR_ID_INTEL 0x8086 | 2290 | #define PCI_VENDOR_ID_INTEL 0x8086 |
| 2268 | #define PCI_DEVICE_ID_INTEL_EESSC 0x0008 | 2291 | #define PCI_DEVICE_ID_INTEL_EESSC 0x0008 |
| 2269 | #define PCI_DEVICE_ID_INTEL_21145 0x0039 | 2292 | #define PCI_DEVICE_ID_INTEL_21145 0x0039 |
| 2293 | #define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 | ||
| 2294 | #define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 | ||
| 2295 | #define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 | ||
| 2296 | #define PCI_DEVICE_ID_INTEL_PXH_1 0x032A | ||
| 2297 | #define PCI_DEVICE_ID_INTEL_PXHV 0x032C | ||
| 2270 | #define PCI_DEVICE_ID_INTEL_82375 0x0482 | 2298 | #define PCI_DEVICE_ID_INTEL_82375 0x0482 |
| 2271 | #define PCI_DEVICE_ID_INTEL_82424 0x0483 | 2299 | #define PCI_DEVICE_ID_INTEL_82424 0x0483 |
| 2272 | #define PCI_DEVICE_ID_INTEL_82378 0x0484 | 2300 | #define PCI_DEVICE_ID_INTEL_82378 0x0484 |
diff --git a/include/linux/phy.h b/include/linux/phy.h new file mode 100644 index 000000000000..72cb67b66e0c --- /dev/null +++ b/include/linux/phy.h | |||
| @@ -0,0 +1,377 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/phy.h | ||
| 3 | * | ||
| 4 | * Framework and drivers for configuring and reading different PHYs | ||
| 5 | * Based on code in sungem_phy.c and gianfar_phy.c | ||
| 6 | * | ||
| 7 | * Author: Andy Fleming | ||
| 8 | * | ||
| 9 | * Copyright (c) 2004 Freescale Semiconductor, Inc. | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify it | ||
| 12 | * under the terms of the GNU General Public License as published by the | ||
| 13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 14 | * option) any later version. | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef __PHY_H | ||
| 19 | #define __PHY_H | ||
| 20 | |||
| 21 | #include <linux/spinlock.h> | ||
| 22 | #include <linux/device.h> | ||
| 23 | |||
| 24 | #define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ | ||
| 25 | SUPPORTED_10baseT_Full | \ | ||
| 26 | SUPPORTED_100baseT_Half | \ | ||
| 27 | SUPPORTED_100baseT_Full | \ | ||
| 28 | SUPPORTED_Autoneg | \ | ||
| 29 | SUPPORTED_TP | \ | ||
| 30 | SUPPORTED_MII) | ||
| 31 | |||
| 32 | #define PHY_GBIT_FEATURES (PHY_BASIC_FEATURES | \ | ||
| 33 | SUPPORTED_1000baseT_Half | \ | ||
| 34 | SUPPORTED_1000baseT_Full) | ||
| 35 | |||
| 36 | /* Set phydev->irq to PHY_POLL if interrupts are not supported, | ||
| 37 | * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if | ||
| 38 | * the attached driver handles the interrupt | ||
| 39 | */ | ||
| 40 | #define PHY_POLL -1 | ||
| 41 | #define PHY_IGNORE_INTERRUPT -2 | ||
| 42 | |||
| 43 | #define PHY_HAS_INTERRUPT 0x00000001 | ||
| 44 | #define PHY_HAS_MAGICANEG 0x00000002 | ||
| 45 | |||
| 46 | #define MII_BUS_MAX 4 | ||
| 47 | |||
| 48 | |||
| 49 | #define PHY_INIT_TIMEOUT 100000 | ||
| 50 | #define PHY_STATE_TIME 1 | ||
| 51 | #define PHY_FORCE_TIMEOUT 10 | ||
| 52 | #define PHY_AN_TIMEOUT 10 | ||
| 53 | |||
| 54 | #define PHY_MAX_ADDR 32 | ||
| 55 | |||
| 56 | /* The Bus class for PHYs. Devices which provide access to | ||
| 57 | * PHYs should register using this structure */ | ||
| 58 | struct mii_bus { | ||
| 59 | const char *name; | ||
| 60 | int id; | ||
| 61 | void *priv; | ||
| 62 | int (*read)(struct mii_bus *bus, int phy_id, int regnum); | ||
| 63 | int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); | ||
| 64 | int (*reset)(struct mii_bus *bus); | ||
| 65 | |||
| 66 | /* A lock to ensure that only one thing can read/write | ||
| 67 | * the MDIO bus at a time */ | ||
| 68 | spinlock_t mdio_lock; | ||
| 69 | |||
| 70 | struct device *dev; | ||
| 71 | |||
| 72 | /* list of all PHYs on bus */ | ||
| 73 | struct phy_device *phy_map[PHY_MAX_ADDR]; | ||
| 74 | |||
| 75 | /* Pointer to an array of interrupts, each PHY's | ||
| 76 | * interrupt at the index matching its address */ | ||
| 77 | int *irq; | ||
| 78 | }; | ||
| 79 | |||
| 80 | #define PHY_INTERRUPT_DISABLED 0x0 | ||
| 81 | #define PHY_INTERRUPT_ENABLED 0x80000000 | ||
| 82 | |||
| 83 | /* PHY state machine states: | ||
| 84 | * | ||
| 85 | * DOWN: PHY device and driver are not ready for anything. probe | ||
| 86 | * should be called if and only if the PHY is in this state, | ||
| 87 | * given that the PHY device exists. | ||
| 88 | * - PHY driver probe function will, depending on the PHY, set | ||
| 89 | * the state to STARTING or READY | ||
| 90 | * | ||
| 91 | * STARTING: PHY device is coming up, and the ethernet driver is | ||
| 92 | * not ready. PHY drivers may set this in the probe function. | ||
| 93 | * If they do, they are responsible for making sure the state is | ||
| 94 | * eventually set to indicate whether the PHY is UP or READY, | ||
| 95 | * depending on the state when the PHY is done starting up. | ||
| 96 | * - PHY driver will set the state to READY | ||
| 97 | * - start will set the state to PENDING | ||
| 98 | * | ||
| 99 | * READY: PHY is ready to send and receive packets, but the | ||
| 100 | * controller is not. By default, PHYs which do not implement | ||
| 101 | * probe will be set to this state by phy_probe(). If the PHY | ||
| 102 | * driver knows the PHY is ready, and the PHY state is STARTING, | ||
| 103 | * then it sets this STATE. | ||
| 104 | * - start will set the state to UP | ||
| 105 | * | ||
| 106 | * PENDING: PHY device is coming up, but the ethernet driver is | ||
| 107 | * ready. phy_start will set this state if the PHY state is | ||
| 108 | * STARTING. | ||
| 109 | * - PHY driver will set the state to UP when the PHY is ready | ||
| 110 | * | ||
| 111 | * UP: The PHY and attached device are ready to do work. | ||
| 112 | * Interrupts should be started here. | ||
| 113 | * - timer moves to AN | ||
| 114 | * | ||
| 115 | * AN: The PHY is currently negotiating the link state. Link is | ||
| 116 | * therefore down for now. phy_timer will set this state when it | ||
| 117 | * detects the state is UP. config_aneg will set this state | ||
| 118 | * whenever called with phydev->autoneg set to AUTONEG_ENABLE. | ||
| 119 | * - If autonegotiation finishes, but there's no link, it sets | ||
| 120 | * the state to NOLINK. | ||
| 121 | * - If aneg finishes with link, it sets the state to RUNNING, | ||
| 122 | * and calls adjust_link | ||
| 123 | * - If autonegotiation did not finish after an arbitrary amount | ||
| 124 | * of time, autonegotiation should be tried again if the PHY | ||
| 125 | * supports "magic" autonegotiation (back to AN) | ||
| 126 | * - If it didn't finish, and no magic_aneg, move to FORCING. | ||
| 127 | * | ||
| 128 | * NOLINK: PHY is up, but not currently plugged in. | ||
| 129 | * - If the timer notes that the link comes back, we move to RUNNING | ||
| 130 | * - config_aneg moves to AN | ||
| 131 | * - phy_stop moves to HALTED | ||
| 132 | * | ||
| 133 | * FORCING: PHY is being configured with forced settings | ||
| 134 | * - if link is up, move to RUNNING | ||
| 135 | * - If link is down, we drop to the next highest setting, and | ||
| 136 | * retry (FORCING) after a timeout | ||
| 137 | * - phy_stop moves to HALTED | ||
| 138 | * | ||
| 139 | * RUNNING: PHY is currently up, running, and possibly sending | ||
| 140 | * and/or receiving packets | ||
| 141 | * - timer will set CHANGELINK if we're polling (this ensures the | ||
| 142 | * link state is polled every other cycle of this state machine, | ||
| 143 | * which makes it every other second) | ||
| 144 | * - irq will set CHANGELINK | ||
| 145 | * - config_aneg will set AN | ||
| 146 | * - phy_stop moves to HALTED | ||
| 147 | * | ||
| 148 | * CHANGELINK: PHY experienced a change in link state | ||
| 149 | * - timer moves to RUNNING if link | ||
| 150 | * - timer moves to NOLINK if the link is down | ||
| 151 | * - phy_stop moves to HALTED | ||
| 152 | * | ||
| 153 | * HALTED: PHY is up, but no polling or interrupts are done. Or | ||
| 154 | * PHY is in an error state. | ||
| 155 | * | ||
| 156 | * - phy_start moves to RESUMING | ||
| 157 | * | ||
| 158 | * RESUMING: PHY was halted, but now wants to run again. | ||
| 159 | * - If we are forcing, or aneg is done, timer moves to RUNNING | ||
| 160 | * - If aneg is not done, timer moves to AN | ||
| 161 | * - phy_stop moves to HALTED | ||
| 162 | */ | ||
| 163 | enum phy_state { | ||
| 164 | PHY_DOWN=0, | ||
| 165 | PHY_STARTING, | ||
| 166 | PHY_READY, | ||
| 167 | PHY_PENDING, | ||
| 168 | PHY_UP, | ||
| 169 | PHY_AN, | ||
| 170 | PHY_RUNNING, | ||
| 171 | PHY_NOLINK, | ||
| 172 | PHY_FORCING, | ||
| 173 | PHY_CHANGELINK, | ||
| 174 | PHY_HALTED, | ||
| 175 | PHY_RESUMING | ||
| 176 | }; | ||
| 177 | |||
| 178 | /* phy_device: An instance of a PHY | ||
| 179 | * | ||
| 180 | * drv: Pointer to the driver for this PHY instance | ||
| 181 | * bus: Pointer to the bus this PHY is on | ||
| 182 | * dev: driver model device structure for this PHY | ||
| 183 | * phy_id: UID for this device found during discovery | ||
| 184 | * state: state of the PHY for management purposes | ||
| 185 | * dev_flags: Device-specific flags used by the PHY driver. | ||
| 186 | * addr: Bus address of PHY | ||
| 187 | * link_timeout: The number of timer firings to wait before the | ||
| 188 | * giving up on the current attempt at acquiring a link | ||
| 189 | * irq: IRQ number of the PHY's interrupt (-1 if none) | ||
| 190 | * phy_timer: The timer for handling the state machine | ||
| 191 | * phy_queue: A work_queue for the interrupt | ||
| 192 | * attached_dev: The attached enet driver's device instance ptr | ||
| 193 | * adjust_link: Callback for the enet controller to respond to | ||
| 194 | * changes in the link state. | ||
| 195 | * adjust_state: Callback for the enet driver to respond to | ||
| 196 | * changes in the state machine. | ||
| 197 | * | ||
| 198 | * speed, duplex, pause, supported, advertising, and | ||
| 199 | * autoneg are used like in mii_if_info | ||
| 200 | * | ||
| 201 | * interrupts currently only supports enabled or disabled, | ||
| 202 | * but could be changed in the future to support enabling | ||
| 203 | * and disabling specific interrupts | ||
| 204 | * | ||
| 205 | * Contains some infrastructure for polling and interrupt | ||
| 206 | * handling, as well as handling shifts in PHY hardware state | ||
| 207 | */ | ||
| 208 | struct phy_device { | ||
| 209 | /* Information about the PHY type */ | ||
| 210 | /* And management functions */ | ||
| 211 | struct phy_driver *drv; | ||
| 212 | |||
| 213 | struct mii_bus *bus; | ||
| 214 | |||
| 215 | struct device dev; | ||
| 216 | |||
| 217 | u32 phy_id; | ||
| 218 | |||
| 219 | enum phy_state state; | ||
| 220 | |||
| 221 | u32 dev_flags; | ||
| 222 | |||
| 223 | /* Bus address of the PHY (0-32) */ | ||
| 224 | int addr; | ||
| 225 | |||
| 226 | /* forced speed & duplex (no autoneg) | ||
| 227 | * partner speed & duplex & pause (autoneg) | ||
| 228 | */ | ||
| 229 | int speed; | ||
| 230 | int duplex; | ||
| 231 | int pause; | ||
| 232 | int asym_pause; | ||
| 233 | |||
| 234 | /* The most recently read link state */ | ||
| 235 | int link; | ||
| 236 | |||
| 237 | /* Enabled Interrupts */ | ||
| 238 | u32 interrupts; | ||
| 239 | |||
| 240 | /* Union of PHY and Attached devices' supported modes */ | ||
| 241 | /* See mii.h for more info */ | ||
| 242 | u32 supported; | ||
| 243 | u32 advertising; | ||
| 244 | |||
| 245 | int autoneg; | ||
| 246 | |||
| 247 | int link_timeout; | ||
| 248 | |||
| 249 | /* Interrupt number for this PHY | ||
| 250 | * -1 means no interrupt */ | ||
| 251 | int irq; | ||
| 252 | |||
| 253 | /* private data pointer */ | ||
| 254 | /* For use by PHYs to maintain extra state */ | ||
| 255 | void *priv; | ||
| 256 | |||
| 257 | /* Interrupt and Polling infrastructure */ | ||
| 258 | struct work_struct phy_queue; | ||
| 259 | struct timer_list phy_timer; | ||
| 260 | |||
| 261 | spinlock_t lock; | ||
| 262 | |||
| 263 | struct net_device *attached_dev; | ||
| 264 | |||
| 265 | void (*adjust_link)(struct net_device *dev); | ||
| 266 | |||
| 267 | void (*adjust_state)(struct net_device *dev); | ||
| 268 | }; | ||
| 269 | #define to_phy_device(d) container_of(d, struct phy_device, dev) | ||
| 270 | |||
| 271 | /* struct phy_driver: Driver structure for a particular PHY type | ||
| 272 | * | ||
| 273 | * phy_id: The result of reading the UID registers of this PHY | ||
| 274 | * type, and ANDing them with the phy_id_mask. This driver | ||
| 275 | * only works for PHYs with IDs which match this field | ||
| 276 | * name: The friendly name of this PHY type | ||
| 277 | * phy_id_mask: Defines the important bits of the phy_id | ||
| 278 | * features: A list of features (speed, duplex, etc) supported | ||
| 279 | * by this PHY | ||
| 280 | * flags: A bitfield defining certain other features this PHY | ||
| 281 | * supports (like interrupts) | ||
| 282 | * | ||
| 283 | * The drivers must implement config_aneg and read_status. All | ||
| 284 | * other functions are optional. Note that none of these | ||
| 285 | * functions should be called from interrupt time. The goal is | ||
| 286 | * for the bus read/write functions to be able to block when the | ||
| 287 | * bus transaction is happening, and be freed up by an interrupt | ||
| 288 | * (The MPC85xx has this ability, though it is not currently | ||
| 289 | * supported in the driver). | ||
| 290 | */ | ||
| 291 | struct phy_driver { | ||
| 292 | u32 phy_id; | ||
| 293 | char *name; | ||
| 294 | unsigned int phy_id_mask; | ||
| 295 | u32 features; | ||
| 296 | u32 flags; | ||
| 297 | |||
| 298 | /* Called to initialize the PHY, | ||
| 299 | * including after a reset */ | ||
| 300 | int (*config_init)(struct phy_device *phydev); | ||
| 301 | |||
| 302 | /* Called during discovery. Used to set | ||
| 303 | * up device-specific structures, if any */ | ||
| 304 | int (*probe)(struct phy_device *phydev); | ||
| 305 | |||
| 306 | /* PHY Power Management */ | ||
| 307 | int (*suspend)(struct phy_device *phydev); | ||
| 308 | int (*resume)(struct phy_device *phydev); | ||
| 309 | |||
| 310 | /* Configures the advertisement and resets | ||
| 311 | * autonegotiation if phydev->autoneg is on, | ||
| 312 | * forces the speed to the current settings in phydev | ||
| 313 | * if phydev->autoneg is off */ | ||
| 314 | int (*config_aneg)(struct phy_device *phydev); | ||
| 315 | |||
| 316 | /* Determines the negotiated speed and duplex */ | ||
| 317 | int (*read_status)(struct phy_device *phydev); | ||
| 318 | |||
| 319 | /* Clears any pending interrupts */ | ||
| 320 | int (*ack_interrupt)(struct phy_device *phydev); | ||
| 321 | |||
| 322 | /* Enables or disables interrupts */ | ||
| 323 | int (*config_intr)(struct phy_device *phydev); | ||
| 324 | |||
| 325 | /* Clears up any memory if needed */ | ||
| 326 | void (*remove)(struct phy_device *phydev); | ||
| 327 | |||
| 328 | struct device_driver driver; | ||
| 329 | }; | ||
| 330 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | ||
| 331 | |||
| 332 | int phy_read(struct phy_device *phydev, u16 regnum); | ||
| 333 | int phy_write(struct phy_device *phydev, u16 regnum, u16 val); | ||
| 334 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | ||
| 335 | int phy_clear_interrupt(struct phy_device *phydev); | ||
| 336 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); | ||
| 337 | struct phy_device * phy_attach(struct net_device *dev, | ||
| 338 | const char *phy_id, u32 flags); | ||
| 339 | struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, | ||
| 340 | void (*handler)(struct net_device *), u32 flags); | ||
| 341 | void phy_disconnect(struct phy_device *phydev); | ||
| 342 | void phy_detach(struct phy_device *phydev); | ||
| 343 | void phy_start(struct phy_device *phydev); | ||
| 344 | void phy_stop(struct phy_device *phydev); | ||
| 345 | int phy_start_aneg(struct phy_device *phydev); | ||
| 346 | |||
| 347 | int mdiobus_register(struct mii_bus *bus); | ||
| 348 | void mdiobus_unregister(struct mii_bus *bus); | ||
| 349 | void phy_sanitize_settings(struct phy_device *phydev); | ||
| 350 | int phy_stop_interrupts(struct phy_device *phydev); | ||
| 351 | |||
| 352 | static inline int phy_read_status(struct phy_device *phydev) { | ||
| 353 | return phydev->drv->read_status(phydev); | ||
| 354 | } | ||
| 355 | |||
| 356 | int genphy_config_advert(struct phy_device *phydev); | ||
| 357 | int genphy_setup_forced(struct phy_device *phydev); | ||
| 358 | int genphy_restart_aneg(struct phy_device *phydev); | ||
| 359 | int genphy_config_aneg(struct phy_device *phydev); | ||
| 360 | int genphy_update_link(struct phy_device *phydev); | ||
| 361 | int genphy_read_status(struct phy_device *phydev); | ||
| 362 | void phy_driver_unregister(struct phy_driver *drv); | ||
| 363 | int phy_driver_register(struct phy_driver *new_driver); | ||
| 364 | void phy_prepare_link(struct phy_device *phydev, | ||
| 365 | void (*adjust_link)(struct net_device *)); | ||
| 366 | void phy_start_machine(struct phy_device *phydev, | ||
| 367 | void (*handler)(struct net_device *)); | ||
| 368 | void phy_stop_machine(struct phy_device *phydev); | ||
| 369 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); | ||
| 370 | int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); | ||
| 371 | int phy_mii_ioctl(struct phy_device *phydev, | ||
| 372 | struct mii_ioctl_data *mii_data, int cmd); | ||
| 373 | int phy_start_interrupts(struct phy_device *phydev); | ||
| 374 | void phy_print_status(struct phy_device *phydev); | ||
| 375 | |||
| 376 | extern struct bus_type mdio_bus_type; | ||
| 377 | #endif /* __PHY_H */ | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index 14479325e3f3..5cfb07648eca 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 | ||
| @@ -186,7 +186,9 @@ extern int pm_suspend(suspend_state_t state); | |||
| 186 | 186 | ||
| 187 | struct device; | 187 | struct device; |
| 188 | 188 | ||
| 189 | typedef u32 __bitwise pm_message_t; | 189 | typedef struct pm_message { |
| 190 | int event; | ||
| 191 | } pm_message_t; | ||
| 190 | 192 | ||
| 191 | /* | 193 | /* |
| 192 | * There are 4 important states driver can be in: | 194 | * There are 4 important states driver can be in: |
| @@ -207,9 +209,13 @@ typedef u32 __bitwise pm_message_t; | |||
| 207 | * or something similar soon. | 209 | * or something similar soon. |
| 208 | */ | 210 | */ |
| 209 | 211 | ||
| 210 | #define PMSG_FREEZE ((__force pm_message_t) 3) | 212 | #define PM_EVENT_ON 0 |
| 211 | #define PMSG_SUSPEND ((__force pm_message_t) 3) | 213 | #define PM_EVENT_FREEZE 1 |
| 212 | #define PMSG_ON ((__force pm_message_t) 0) | 214 | #define PM_EVENT_SUSPEND 2 |
| 215 | |||
| 216 | #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) | ||
| 217 | #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) | ||
| 218 | #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) | ||
| 213 | 219 | ||
| 214 | struct dev_pm_info { | 220 | struct dev_pm_info { |
| 215 | pm_message_t power_state; | 221 | pm_message_t power_state; |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index a373fc254df2..2afdafb62123 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #define PTRACE_DETACH 0x11 | 20 | #define PTRACE_DETACH 0x11 |
| 21 | 21 | ||
| 22 | #define PTRACE_SYSCALL 24 | 22 | #define PTRACE_SYSCALL 24 |
| 23 | #define PTRACE_SYSEMU 31 | ||
| 24 | #define PTRACE_SYSEMU_SINGLESTEP 32 | ||
| 23 | 25 | ||
| 24 | /* 0x4200-0x4300 are reserved for architecture-independent additions. */ | 26 | /* 0x4200-0x4300 are reserved for architecture-independent additions. */ |
| 25 | #define PTRACE_SETOPTIONS 0x4200 | 27 | #define PTRACE_SETOPTIONS 0x4200 |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index e24b74b11150..4bf1659f8aa8 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
| @@ -248,6 +248,7 @@ struct bitmap { | |||
| 248 | 248 | ||
| 249 | /* these are used only by md/bitmap */ | 249 | /* these are used only by md/bitmap */ |
| 250 | int bitmap_create(mddev_t *mddev); | 250 | int bitmap_create(mddev_t *mddev); |
| 251 | void bitmap_flush(mddev_t *mddev); | ||
| 251 | void bitmap_destroy(mddev_t *mddev); | 252 | void bitmap_destroy(mddev_t *mddev); |
| 252 | int bitmap_active(struct bitmap *bitmap); | 253 | int bitmap_active(struct bitmap *bitmap); |
| 253 | 254 | ||
| @@ -262,7 +263,7 @@ void bitmap_write_all(struct bitmap *bitmap); | |||
| 262 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); | 263 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); |
| 263 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | 264 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, |
| 264 | int success); | 265 | int success); |
| 265 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks); | 266 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); |
| 266 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); | 267 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); |
| 267 | void bitmap_close_sync(struct bitmap *bitmap); | 268 | void bitmap_close_sync(struct bitmap *bitmap); |
| 268 | 269 | ||
diff --git a/include/linux/random.h b/include/linux/random.h index cc6703449916..7b2adb3322d5 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
| @@ -59,6 +59,8 @@ extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, | |||
| 59 | __u16 sport, __u16 dport); | 59 | __u16 sport, __u16 dport); |
| 60 | extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, | 60 | extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, |
| 61 | __u16 sport, __u16 dport); | 61 | __u16 sport, __u16 dport); |
| 62 | extern u64 secure_dccp_sequence_number(__u32 saddr, __u32 daddr, | ||
| 63 | __u16 sport, __u16 dport); | ||
| 62 | 64 | ||
| 63 | #ifndef MODULE | 65 | #ifndef MODULE |
| 64 | extern struct file_operations random_fops, urandom_fops; | 66 | extern struct file_operations random_fops, urandom_fops; |
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 2d4dd23168dd..3b3266ff1a95 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
| @@ -55,6 +55,22 @@ extern void machine_shutdown(void); | |||
| 55 | struct pt_regs; | 55 | struct pt_regs; |
| 56 | extern void machine_crash_shutdown(struct pt_regs *); | 56 | extern void machine_crash_shutdown(struct pt_regs *); |
| 57 | 57 | ||
| 58 | /* | ||
| 59 | * Architecture independent implemenations of sys_reboot commands. | ||
| 60 | */ | ||
| 61 | |||
| 62 | extern void kernel_restart(char *cmd); | ||
| 63 | extern void kernel_halt(void); | ||
| 64 | extern void kernel_power_off(void); | ||
| 65 | extern void kernel_kexec(void); | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Emergency restart, callable from an interrupt handler. | ||
| 69 | */ | ||
| 70 | |||
| 71 | extern void emergency_restart(void); | ||
| 72 | #include <asm/emergency-restart.h> | ||
| 73 | |||
| 58 | #endif | 74 | #endif |
| 59 | 75 | ||
| 60 | #endif /* _LINUX_REBOOT_H */ | 76 | #endif /* _LINUX_REBOOT_H */ |
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/rtnetlink.h b/include/linux/rtnetlink.h index 657c05ab8f9e..c231e9a08f0b 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
| @@ -826,9 +826,8 @@ enum | |||
| 826 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) | 826 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) |
| 827 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) | 827 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) |
| 828 | 828 | ||
| 829 | 829 | #ifndef __KERNEL__ | |
| 830 | /* RTnetlink multicast groups */ | 830 | /* RTnetlink multicast groups - backwards compatibility for userspace */ |
| 831 | |||
| 832 | #define RTMGRP_LINK 1 | 831 | #define RTMGRP_LINK 1 |
| 833 | #define RTMGRP_NOTIFY 2 | 832 | #define RTMGRP_NOTIFY 2 |
| 834 | #define RTMGRP_NEIGH 4 | 833 | #define RTMGRP_NEIGH 4 |
| @@ -847,6 +846,43 @@ enum | |||
| 847 | #define RTMGRP_DECnet_ROUTE 0x4000 | 846 | #define RTMGRP_DECnet_ROUTE 0x4000 |
| 848 | 847 | ||
| 849 | #define RTMGRP_IPV6_PREFIX 0x20000 | 848 | #define RTMGRP_IPV6_PREFIX 0x20000 |
| 849 | #endif | ||
| 850 | |||
| 851 | /* RTnetlink multicast groups */ | ||
| 852 | enum rtnetlink_groups { | ||
| 853 | RTNLGRP_NONE, | ||
| 854 | #define RTNLGRP_NONE RTNLGRP_NONE | ||
| 855 | RTNLGRP_LINK, | ||
| 856 | #define RTNLGRP_LINK RTNLGRP_LINK | ||
| 857 | RTNLGRP_NOTIFY, | ||
| 858 | #define RTNLGRP_NOTIFY RTNLGRP_NOTIFY | ||
| 859 | RTNLGRP_NEIGH, | ||
| 860 | #define RTNLGRP_NEIGH RTNLGRP_NEIGH | ||
| 861 | RTNLGRP_TC, | ||
| 862 | #define RTNLGRP_TC RTNLGRP_TC | ||
| 863 | RTNLGRP_IPV4_IFADDR, | ||
| 864 | #define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR | ||
| 865 | RTNLGRP_IPV4_MROUTE, | ||
| 866 | #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE | ||
| 867 | RTNLGRP_IPV4_ROUTE, | ||
| 868 | #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE | ||
| 869 | RTNLGRP_IPV6_IFADDR, | ||
| 870 | #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR | ||
| 871 | RTNLGRP_IPV6_MROUTE, | ||
| 872 | #define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE | ||
| 873 | RTNLGRP_IPV6_ROUTE, | ||
| 874 | #define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE | ||
| 875 | RTNLGRP_IPV6_IFINFO, | ||
| 876 | #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO | ||
| 877 | RTNLGRP_DECnet_IFADDR, | ||
| 878 | #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR | ||
| 879 | RTNLGRP_DECnet_ROUTE, | ||
| 880 | #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE | ||
| 881 | RTNLGRP_IPV6_PREFIX, | ||
| 882 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX | ||
| 883 | __RTNLGRP_MAX | ||
| 884 | }; | ||
| 885 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | ||
| 850 | 886 | ||
| 851 | /* TC action piece */ | 887 | /* TC action piece */ |
| 852 | struct tcamsg | 888 | struct tcamsg |
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/security.h b/include/linux/security.h index b42095a68b1c..7aab6ab7c57f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -2727,7 +2727,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o | |||
| 2727 | return security_ops->socket_getpeersec(sock, optval, optlen, len); | 2727 | return security_ops->socket_getpeersec(sock, optval, optlen, len); |
| 2728 | } | 2728 | } |
| 2729 | 2729 | ||
| 2730 | static inline int security_sk_alloc(struct sock *sk, int family, int priority) | 2730 | static inline int security_sk_alloc(struct sock *sk, int family, |
| 2731 | unsigned int __nocast priority) | ||
| 2731 | { | 2732 | { |
| 2732 | return security_ops->sk_alloc_security(sk, family, priority); | 2733 | return security_ops->sk_alloc_security(sk, family, priority); |
| 2733 | } | 2734 | } |
| @@ -2844,7 +2845,8 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o | |||
| 2844 | return -ENOPROTOOPT; | 2845 | return -ENOPROTOOPT; |
| 2845 | } | 2846 | } |
| 2846 | 2847 | ||
| 2847 | static inline int security_sk_alloc(struct sock *sk, int family, int priority) | 2848 | static inline int security_sk_alloc(struct sock *sk, int family, |
| 2849 | unsigned int __nocast priority) | ||
| 2848 | { | 2850 | { |
| 2849 | return 0; | 2851 | return 0; |
| 2850 | } | 2852 | } |
diff --git a/include/linux/selinux_netlink.h b/include/linux/selinux_netlink.h index 957e6ebca4e6..bbf489decd84 100644 --- a/include/linux/selinux_netlink.h +++ b/include/linux/selinux_netlink.h | |||
| @@ -20,10 +20,21 @@ enum { | |||
| 20 | SELNL_MSG_MAX | 20 | SELNL_MSG_MAX |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | /* Multicast groups */ | 23 | #ifndef __KERNEL__ |
| 24 | /* Multicast groups - backwards compatiblility for userspace */ | ||
| 24 | #define SELNL_GRP_NONE 0x00000000 | 25 | #define SELNL_GRP_NONE 0x00000000 |
| 25 | #define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ | 26 | #define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ |
| 26 | #define SELNL_GRP_ALL 0xffffffff | 27 | #define SELNL_GRP_ALL 0xffffffff |
| 28 | #endif | ||
| 29 | |||
| 30 | enum selinux_nlgroups { | ||
| 31 | SELNLGRP_NONE, | ||
| 32 | #define SELNLGRP_NONE SELNLGRP_NONE | ||
| 33 | SELNLGRP_AVC, | ||
| 34 | #define SELNLGRP_AVC SELNLGRP_AVC | ||
| 35 | __SELNLGRP_MAX | ||
| 36 | }; | ||
| 37 | #define SELNLGRP_MAX (__SELNLGRP_MAX - 1) | ||
| 27 | 38 | ||
| 28 | /* Message structures */ | 39 | /* Message structures */ |
| 29 | struct selnl_msg_setenforce { | 40 | struct selnl_msg_setenforce { |
diff --git a/include/linux/serial.h b/include/linux/serial.h index 00145822fb74..12cd9cf65e8f 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
| @@ -174,9 +174,7 @@ struct serial_icounter_struct { | |||
| 174 | 174 | ||
| 175 | 175 | ||
| 176 | #ifdef __KERNEL__ | 176 | #ifdef __KERNEL__ |
| 177 | /* Export to allow PCMCIA to use this - Dave Hinds */ | 177 | #include <linux/compiler.h> |
| 178 | extern int register_serial(struct serial_struct *req); | ||
| 179 | extern void unregister_serial(int line); | ||
| 180 | 178 | ||
| 181 | /* Allow architectures to override entries in serial8250_ports[] at run time: */ | 179 | /* Allow architectures to override entries in serial8250_ports[] at run time: */ |
| 182 | struct uart_port; /* forward declaration */ | 180 | struct uart_port; /* forward declaration */ |
diff --git a/include/linux/serialP.h b/include/linux/serialP.h index 2307f11d8a6b..2b9e6b9554d5 100644 --- a/include/linux/serialP.h +++ b/include/linux/serialP.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | * For definitions of the flags field, see tty.h | 19 | * For definitions of the flags field, see tty.h |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/version.h> | ||
| 23 | #include <linux/config.h> | 22 | #include <linux/config.h> |
| 24 | #include <linux/termios.h> | 23 | #include <linux/termios.h> |
| 25 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
| @@ -141,44 +140,4 @@ struct rs_multiport_struct { | |||
| 141 | #define ALPHA_KLUDGE_MCR 0 | 140 | #define ALPHA_KLUDGE_MCR 0 |
| 142 | #endif | 141 | #endif |
| 143 | 142 | ||
| 144 | /* | ||
| 145 | * Definitions for PCI support. | ||
| 146 | */ | ||
| 147 | #define SPCI_FL_BASE_MASK 0x0007 | ||
| 148 | #define SPCI_FL_BASE0 0x0000 | ||
| 149 | #define SPCI_FL_BASE1 0x0001 | ||
| 150 | #define SPCI_FL_BASE2 0x0002 | ||
| 151 | #define SPCI_FL_BASE3 0x0003 | ||
| 152 | #define SPCI_FL_BASE4 0x0004 | ||
| 153 | #define SPCI_FL_GET_BASE(x) (x & SPCI_FL_BASE_MASK) | ||
| 154 | |||
| 155 | #define SPCI_FL_IRQ_MASK (0x0007 << 4) | ||
| 156 | #define SPCI_FL_IRQBASE0 (0x0000 << 4) | ||
| 157 | #define SPCI_FL_IRQBASE1 (0x0001 << 4) | ||
| 158 | #define SPCI_FL_IRQBASE2 (0x0002 << 4) | ||
| 159 | #define SPCI_FL_IRQBASE3 (0x0003 << 4) | ||
| 160 | #define SPCI_FL_IRQBASE4 (0x0004 << 4) | ||
| 161 | #define SPCI_FL_GET_IRQBASE(x) ((x & SPCI_FL_IRQ_MASK) >> 4) | ||
| 162 | |||
| 163 | /* Use successive BARs (PCI base address registers), | ||
| 164 | else use offset into some specified BAR */ | ||
| 165 | #define SPCI_FL_BASE_TABLE 0x0100 | ||
| 166 | |||
| 167 | /* Use successive entries in the irq resource table */ | ||
| 168 | #define SPCI_FL_IRQ_TABLE 0x0200 | ||
| 169 | |||
| 170 | /* Use the irq resource table instead of dev->irq */ | ||
| 171 | #define SPCI_FL_IRQRESOURCE 0x0400 | ||
| 172 | |||
| 173 | /* Use the Base address register size to cap number of ports */ | ||
| 174 | #define SPCI_FL_REGION_SZ_CAP 0x0800 | ||
| 175 | |||
| 176 | /* Do not use irq sharing for this device */ | ||
| 177 | #define SPCI_FL_NO_SHIRQ 0x1000 | ||
| 178 | |||
| 179 | /* This is a PNP device */ | ||
| 180 | #define SPCI_FL_ISPNP 0x2000 | ||
| 181 | |||
| 182 | #define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE|SPCI_FL_ISPNP) | ||
| 183 | |||
| 184 | #endif /* _LINUX_SERIAL_H */ | 143 | #endif /* _LINUX_SERIAL_H */ |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 3e3c1fa35b06..d8a023d804d4 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -14,6 +14,9 @@ | |||
| 14 | #include <linux/serial_core.h> | 14 | #include <linux/serial_core.h> |
| 15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
| 16 | 16 | ||
| 17 | /* | ||
| 18 | * This is the platform device platform_data structure | ||
| 19 | */ | ||
| 17 | struct plat_serial8250_port { | 20 | struct plat_serial8250_port { |
| 18 | unsigned long iobase; /* io base address */ | 21 | unsigned long iobase; /* io base address */ |
| 19 | void __iomem *membase; /* ioremap cookie or NULL */ | 22 | void __iomem *membase; /* ioremap cookie or NULL */ |
| @@ -26,4 +29,17 @@ struct plat_serial8250_port { | |||
| 26 | unsigned int flags; /* UPF_* flags */ | 29 | unsigned int flags; /* UPF_* flags */ |
| 27 | }; | 30 | }; |
| 28 | 31 | ||
| 32 | /* | ||
| 33 | * This should be used by drivers which want to register | ||
| 34 | * their own 8250 ports without registering their own | ||
| 35 | * platform device. Using these will make your driver | ||
| 36 | * dependent on the 8250 driver. | ||
| 37 | */ | ||
| 38 | struct uart_port; | ||
| 39 | |||
| 40 | int serial8250_register_port(struct uart_port *); | ||
| 41 | void serial8250_unregister_port(int line); | ||
| 42 | void serial8250_suspend_port(int line); | ||
| 43 | void serial8250_resume_port(int line); | ||
| 44 | |||
| 29 | #endif | 45 | #endif |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d6025af7efac..cf0f64ea2bc0 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -104,7 +104,7 @@ | |||
| 104 | #define PORT_MPSC 63 | 104 | #define PORT_MPSC 63 |
| 105 | 105 | ||
| 106 | /* TXX9 type number */ | 106 | /* TXX9 type number */ |
| 107 | #define PORT_TXX9 64 | 107 | #define PORT_TXX9 64 |
| 108 | 108 | ||
| 109 | /* NEC VR4100 series SIU/DSIU */ | 109 | /* NEC VR4100 series SIU/DSIU */ |
| 110 | #define PORT_VR41XX_SIU 65 | 110 | #define PORT_VR41XX_SIU 65 |
| @@ -122,6 +122,7 @@ | |||
| 122 | #ifdef __KERNEL__ | 122 | #ifdef __KERNEL__ |
| 123 | 123 | ||
| 124 | #include <linux/config.h> | 124 | #include <linux/config.h> |
| 125 | #include <linux/compiler.h> | ||
| 125 | #include <linux/interrupt.h> | 126 | #include <linux/interrupt.h> |
| 126 | #include <linux/circ_buf.h> | 127 | #include <linux/circ_buf.h> |
| 127 | #include <linux/spinlock.h> | 128 | #include <linux/spinlock.h> |
| @@ -141,8 +142,8 @@ struct uart_ops { | |||
| 141 | unsigned int (*tx_empty)(struct uart_port *); | 142 | unsigned int (*tx_empty)(struct uart_port *); |
| 142 | void (*set_mctrl)(struct uart_port *, unsigned int mctrl); | 143 | void (*set_mctrl)(struct uart_port *, unsigned int mctrl); |
| 143 | unsigned int (*get_mctrl)(struct uart_port *); | 144 | unsigned int (*get_mctrl)(struct uart_port *); |
| 144 | void (*stop_tx)(struct uart_port *, unsigned int tty_stop); | 145 | void (*stop_tx)(struct uart_port *); |
| 145 | void (*start_tx)(struct uart_port *, unsigned int tty_start); | 146 | void (*start_tx)(struct uart_port *); |
| 146 | void (*send_xchar)(struct uart_port *, char ch); | 147 | void (*send_xchar)(struct uart_port *, char ch); |
| 147 | void (*stop_rx)(struct uart_port *); | 148 | void (*stop_rx)(struct uart_port *); |
| 148 | void (*enable_ms)(struct uart_port *); | 149 | void (*enable_ms)(struct uart_port *); |
| @@ -359,8 +360,6 @@ struct tty_driver *uart_console_device(struct console *co, int *index); | |||
| 359 | */ | 360 | */ |
| 360 | int uart_register_driver(struct uart_driver *uart); | 361 | int uart_register_driver(struct uart_driver *uart); |
| 361 | void uart_unregister_driver(struct uart_driver *uart); | 362 | void uart_unregister_driver(struct uart_driver *uart); |
| 362 | void uart_unregister_port(struct uart_driver *reg, int line); | ||
| 363 | int uart_register_port(struct uart_driver *reg, struct uart_port *port); | ||
| 364 | int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); | 363 | int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); |
| 365 | int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); | 364 | int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); |
| 366 | int uart_match_port(struct uart_port *port1, struct uart_port *port2); | 365 | int uart_match_port(struct uart_port *port1, struct uart_port *port2); |
| @@ -467,13 +466,13 @@ uart_handle_cts_change(struct uart_port *port, unsigned int status) | |||
| 467 | if (tty->hw_stopped) { | 466 | if (tty->hw_stopped) { |
| 468 | if (status) { | 467 | if (status) { |
| 469 | tty->hw_stopped = 0; | 468 | tty->hw_stopped = 0; |
| 470 | port->ops->start_tx(port, 0); | 469 | port->ops->start_tx(port); |
| 471 | uart_write_wakeup(port); | 470 | uart_write_wakeup(port); |
| 472 | } | 471 | } |
| 473 | } else { | 472 | } else { |
| 474 | if (!status) { | 473 | if (!status) { |
| 475 | tty->hw_stopped = 1; | 474 | tty->hw_stopped = 1; |
| 476 | port->ops->stop_tx(port, 0); | 475 | port->ops->stop_tx(port); |
| 477 | } | 476 | } |
| 478 | } | 477 | } |
| 479 | } | 478 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5d4a990d5577..42edce6abe23 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -155,16 +155,29 @@ struct skb_shared_info { | |||
| 155 | #define SKB_DATAREF_SHIFT 16 | 155 | #define SKB_DATAREF_SHIFT 16 |
| 156 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) | 156 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) |
| 157 | 157 | ||
| 158 | extern struct timeval skb_tv_base; | ||
| 159 | |||
| 160 | struct skb_timeval { | ||
| 161 | u32 off_sec; | ||
| 162 | u32 off_usec; | ||
| 163 | }; | ||
| 164 | |||
| 165 | |||
| 166 | enum { | ||
| 167 | SKB_FCLONE_UNAVAILABLE, | ||
| 168 | SKB_FCLONE_ORIG, | ||
| 169 | SKB_FCLONE_CLONE, | ||
| 170 | }; | ||
| 171 | |||
| 158 | /** | 172 | /** |
| 159 | * struct sk_buff - socket buffer | 173 | * struct sk_buff - socket buffer |
| 160 | * @next: Next buffer in list | 174 | * @next: Next buffer in list |
| 161 | * @prev: Previous buffer in list | 175 | * @prev: Previous buffer in list |
| 162 | * @list: List we are on | 176 | * @list: List we are on |
| 163 | * @sk: Socket we are owned by | 177 | * @sk: Socket we are owned by |
| 164 | * @stamp: Time we arrived | 178 | * @tstamp: Time we arrived stored as offset to skb_tv_base |
| 165 | * @dev: Device we arrived on/are leaving by | 179 | * @dev: Device we arrived on/are leaving by |
| 166 | * @input_dev: Device we arrived on | 180 | * @input_dev: Device we arrived on |
| 167 | * @real_dev: The real device we are using | ||
| 168 | * @h: Transport layer header | 181 | * @h: Transport layer header |
| 169 | * @nh: Network layer header | 182 | * @nh: Network layer header |
| 170 | * @mac: Link layer header | 183 | * @mac: Link layer header |
| @@ -190,14 +203,11 @@ struct skb_shared_info { | |||
| 190 | * @end: End pointer | 203 | * @end: End pointer |
| 191 | * @destructor: Destruct function | 204 | * @destructor: Destruct function |
| 192 | * @nfmark: Can be used for communication between hooks | 205 | * @nfmark: Can be used for communication between hooks |
| 193 | * @nfcache: Cache info | ||
| 194 | * @nfct: Associated connection, if any | 206 | * @nfct: Associated connection, if any |
| 195 | * @nfctinfo: Relationship of this skb to the connection | 207 | * @nfctinfo: Relationship of this skb to the connection |
| 196 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c | 208 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c |
| 197 | * @private: Data which is private to the HIPPI implementation | ||
| 198 | * @tc_index: Traffic control index | 209 | * @tc_index: Traffic control index |
| 199 | * @tc_verd: traffic control verdict | 210 | * @tc_verd: traffic control verdict |
| 200 | * @tc_classid: traffic control classid | ||
| 201 | */ | 211 | */ |
| 202 | 212 | ||
| 203 | struct sk_buff { | 213 | struct sk_buff { |
| @@ -205,12 +215,10 @@ struct sk_buff { | |||
| 205 | struct sk_buff *next; | 215 | struct sk_buff *next; |
| 206 | struct sk_buff *prev; | 216 | struct sk_buff *prev; |
| 207 | 217 | ||
| 208 | struct sk_buff_head *list; | ||
| 209 | struct sock *sk; | 218 | struct sock *sk; |
| 210 | struct timeval stamp; | 219 | struct skb_timeval tstamp; |
| 211 | struct net_device *dev; | 220 | struct net_device *dev; |
| 212 | struct net_device *input_dev; | 221 | struct net_device *input_dev; |
| 213 | struct net_device *real_dev; | ||
| 214 | 222 | ||
| 215 | union { | 223 | union { |
| 216 | struct tcphdr *th; | 224 | struct tcphdr *th; |
| @@ -252,33 +260,28 @@ struct sk_buff { | |||
| 252 | __u8 local_df:1, | 260 | __u8 local_df:1, |
| 253 | cloned:1, | 261 | cloned:1, |
| 254 | ip_summed:2, | 262 | ip_summed:2, |
| 255 | nohdr:1; | 263 | nohdr:1, |
| 256 | /* 3 bits spare */ | 264 | nfctinfo:3; |
| 257 | __u8 pkt_type; | 265 | __u8 pkt_type:3, |
| 258 | __u16 protocol; | 266 | fclone:2; |
| 267 | __be16 protocol; | ||
| 259 | 268 | ||
| 260 | void (*destructor)(struct sk_buff *skb); | 269 | void (*destructor)(struct sk_buff *skb); |
| 261 | #ifdef CONFIG_NETFILTER | 270 | #ifdef CONFIG_NETFILTER |
| 262 | unsigned long nfmark; | 271 | __u32 nfmark; |
| 263 | __u32 nfcache; | ||
| 264 | __u32 nfctinfo; | ||
| 265 | struct nf_conntrack *nfct; | 272 | struct nf_conntrack *nfct; |
| 273 | #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) | ||
| 274 | __u8 ipvs_property:1; | ||
| 275 | #endif | ||
| 266 | #ifdef CONFIG_BRIDGE_NETFILTER | 276 | #ifdef CONFIG_BRIDGE_NETFILTER |
| 267 | struct nf_bridge_info *nf_bridge; | 277 | struct nf_bridge_info *nf_bridge; |
| 268 | #endif | 278 | #endif |
| 269 | #endif /* CONFIG_NETFILTER */ | 279 | #endif /* CONFIG_NETFILTER */ |
| 270 | #if defined(CONFIG_HIPPI) | ||
| 271 | union { | ||
| 272 | __u32 ifield; | ||
| 273 | } private; | ||
| 274 | #endif | ||
| 275 | #ifdef CONFIG_NET_SCHED | 280 | #ifdef CONFIG_NET_SCHED |
| 276 | __u32 tc_index; /* traffic control index */ | 281 | __u16 tc_index; /* traffic control index */ |
| 277 | #ifdef CONFIG_NET_CLS_ACT | 282 | #ifdef CONFIG_NET_CLS_ACT |
| 278 | __u32 tc_verd; /* traffic control verdict */ | 283 | __u16 tc_verd; /* traffic control verdict */ |
| 279 | __u32 tc_classid; /* traffic control classid */ | ||
| 280 | #endif | 284 | #endif |
| 281 | |||
| 282 | #endif | 285 | #endif |
| 283 | 286 | ||
| 284 | 287 | ||
| @@ -300,8 +303,20 @@ struct sk_buff { | |||
| 300 | #include <asm/system.h> | 303 | #include <asm/system.h> |
| 301 | 304 | ||
| 302 | extern void __kfree_skb(struct sk_buff *skb); | 305 | extern void __kfree_skb(struct sk_buff *skb); |
| 303 | extern struct sk_buff *alloc_skb(unsigned int size, | 306 | extern struct sk_buff *__alloc_skb(unsigned int size, |
| 304 | unsigned int __nocast priority); | 307 | unsigned int __nocast priority, int fclone); |
| 308 | static inline struct sk_buff *alloc_skb(unsigned int size, | ||
| 309 | unsigned int __nocast priority) | ||
| 310 | { | ||
| 311 | return __alloc_skb(size, priority, 0); | ||
| 312 | } | ||
| 313 | |||
| 314 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | ||
| 315 | unsigned int __nocast priority) | ||
| 316 | { | ||
| 317 | return __alloc_skb(size, priority, 1); | ||
| 318 | } | ||
| 319 | |||
| 305 | extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, | 320 | extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, |
| 306 | unsigned int size, | 321 | unsigned int size, |
| 307 | unsigned int __nocast priority); | 322 | unsigned int __nocast priority); |
| @@ -502,7 +517,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, | |||
| 502 | * | 517 | * |
| 503 | * %NULL is returned on a memory allocation failure. | 518 | * %NULL is returned on a memory allocation failure. |
| 504 | */ | 519 | */ |
| 505 | static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) | 520 | static inline struct sk_buff *skb_unshare(struct sk_buff *skb, |
| 521 | unsigned int __nocast pri) | ||
| 506 | { | 522 | { |
| 507 | might_sleep_if(pri & __GFP_WAIT); | 523 | might_sleep_if(pri & __GFP_WAIT); |
| 508 | if (skb_cloned(skb)) { | 524 | if (skb_cloned(skb)) { |
| @@ -596,7 +612,6 @@ static inline void __skb_queue_head(struct sk_buff_head *list, | |||
| 596 | { | 612 | { |
| 597 | struct sk_buff *prev, *next; | 613 | struct sk_buff *prev, *next; |
| 598 | 614 | ||
| 599 | newsk->list = list; | ||
| 600 | list->qlen++; | 615 | list->qlen++; |
| 601 | prev = (struct sk_buff *)list; | 616 | prev = (struct sk_buff *)list; |
| 602 | next = prev->next; | 617 | next = prev->next; |
| @@ -621,7 +636,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list, | |||
| 621 | { | 636 | { |
| 622 | struct sk_buff *prev, *next; | 637 | struct sk_buff *prev, *next; |
| 623 | 638 | ||
| 624 | newsk->list = list; | ||
| 625 | list->qlen++; | 639 | list->qlen++; |
| 626 | next = (struct sk_buff *)list; | 640 | next = (struct sk_buff *)list; |
| 627 | prev = next->prev; | 641 | prev = next->prev; |
| @@ -654,7 +668,6 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) | |||
| 654 | next->prev = prev; | 668 | next->prev = prev; |
| 655 | prev->next = next; | 669 | prev->next = next; |
| 656 | result->next = result->prev = NULL; | 670 | result->next = result->prev = NULL; |
| 657 | result->list = NULL; | ||
| 658 | } | 671 | } |
| 659 | return result; | 672 | return result; |
| 660 | } | 673 | } |
| @@ -663,7 +676,7 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) | |||
| 663 | /* | 676 | /* |
| 664 | * Insert a packet on a list. | 677 | * Insert a packet on a list. |
| 665 | */ | 678 | */ |
| 666 | extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk); | 679 | extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); |
| 667 | static inline void __skb_insert(struct sk_buff *newsk, | 680 | static inline void __skb_insert(struct sk_buff *newsk, |
| 668 | struct sk_buff *prev, struct sk_buff *next, | 681 | struct sk_buff *prev, struct sk_buff *next, |
| 669 | struct sk_buff_head *list) | 682 | struct sk_buff_head *list) |
| @@ -671,24 +684,23 @@ static inline void __skb_insert(struct sk_buff *newsk, | |||
| 671 | newsk->next = next; | 684 | newsk->next = next; |
| 672 | newsk->prev = prev; | 685 | newsk->prev = prev; |
| 673 | next->prev = prev->next = newsk; | 686 | next->prev = prev->next = newsk; |
| 674 | newsk->list = list; | ||
| 675 | list->qlen++; | 687 | list->qlen++; |
| 676 | } | 688 | } |
| 677 | 689 | ||
| 678 | /* | 690 | /* |
| 679 | * Place a packet after a given packet in a list. | 691 | * Place a packet after a given packet in a list. |
| 680 | */ | 692 | */ |
| 681 | extern void skb_append(struct sk_buff *old, struct sk_buff *newsk); | 693 | extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); |
| 682 | static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk) | 694 | static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list) |
| 683 | { | 695 | { |
| 684 | __skb_insert(newsk, old, old->next, old->list); | 696 | __skb_insert(newsk, old, old->next, list); |
| 685 | } | 697 | } |
| 686 | 698 | ||
| 687 | /* | 699 | /* |
| 688 | * remove sk_buff from list. _Must_ be called atomically, and with | 700 | * remove sk_buff from list. _Must_ be called atomically, and with |
| 689 | * the list known.. | 701 | * the list known.. |
| 690 | */ | 702 | */ |
| 691 | extern void skb_unlink(struct sk_buff *skb); | 703 | extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list); |
| 692 | static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) | 704 | static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) |
| 693 | { | 705 | { |
| 694 | struct sk_buff *next, *prev; | 706 | struct sk_buff *next, *prev; |
| @@ -697,7 +709,6 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) | |||
| 697 | next = skb->next; | 709 | next = skb->next; |
| 698 | prev = skb->prev; | 710 | prev = skb->prev; |
| 699 | skb->next = skb->prev = NULL; | 711 | skb->next = skb->prev = NULL; |
| 700 | skb->list = NULL; | ||
| 701 | next->prev = prev; | 712 | next->prev = prev; |
| 702 | prev->next = next; | 713 | prev->next = next; |
| 703 | } | 714 | } |
| @@ -1212,6 +1223,8 @@ extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); | |||
| 1212 | extern void skb_split(struct sk_buff *skb, | 1223 | extern void skb_split(struct sk_buff *skb, |
| 1213 | struct sk_buff *skb1, const u32 len); | 1224 | struct sk_buff *skb1, const u32 len); |
| 1214 | 1225 | ||
| 1226 | extern void skb_release_data(struct sk_buff *skb); | ||
| 1227 | |||
| 1215 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 1228 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
| 1216 | int len, void *buffer) | 1229 | int len, void *buffer) |
| 1217 | { | 1230 | { |
| @@ -1229,6 +1242,42 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
| 1229 | extern void skb_init(void); | 1242 | extern void skb_init(void); |
| 1230 | extern void skb_add_mtu(int mtu); | 1243 | extern void skb_add_mtu(int mtu); |
| 1231 | 1244 | ||
| 1245 | /** | ||
| 1246 | * skb_get_timestamp - get timestamp from a skb | ||
| 1247 | * @skb: skb to get stamp from | ||
| 1248 | * @stamp: pointer to struct timeval to store stamp in | ||
| 1249 | * | ||
| 1250 | * Timestamps are stored in the skb as offsets to a base timestamp. | ||
| 1251 | * This function converts the offset back to a struct timeval and stores | ||
| 1252 | * it in stamp. | ||
| 1253 | */ | ||
| 1254 | static inline void skb_get_timestamp(struct sk_buff *skb, struct timeval *stamp) | ||
| 1255 | { | ||
| 1256 | stamp->tv_sec = skb->tstamp.off_sec; | ||
| 1257 | stamp->tv_usec = skb->tstamp.off_usec; | ||
| 1258 | if (skb->tstamp.off_sec) { | ||
| 1259 | stamp->tv_sec += skb_tv_base.tv_sec; | ||
| 1260 | stamp->tv_usec += skb_tv_base.tv_usec; | ||
| 1261 | } | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | /** | ||
| 1265 | * skb_set_timestamp - set timestamp of a skb | ||
| 1266 | * @skb: skb to set stamp of | ||
| 1267 | * @stamp: pointer to struct timeval to get stamp from | ||
| 1268 | * | ||
| 1269 | * Timestamps are stored in the skb as offsets to a base timestamp. | ||
| 1270 | * This function converts a struct timeval to an offset and stores | ||
| 1271 | * it in the skb. | ||
| 1272 | */ | ||
| 1273 | static inline void skb_set_timestamp(struct sk_buff *skb, struct timeval *stamp) | ||
| 1274 | { | ||
| 1275 | skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec; | ||
| 1276 | skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec; | ||
| 1277 | } | ||
| 1278 | |||
| 1279 | extern void __net_timestamp(struct sk_buff *skb); | ||
| 1280 | |||
| 1232 | #ifdef CONFIG_NETFILTER | 1281 | #ifdef CONFIG_NETFILTER |
| 1233 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) | 1282 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) |
| 1234 | { | 1283 | { |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 4c8e552471b0..80b2dfde2e80 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -111,7 +111,7 @@ static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int n | |||
| 111 | { | 111 | { |
| 112 | return kmem_cache_alloc(cachep, flags); | 112 | return kmem_cache_alloc(cachep, flags); |
| 113 | } | 113 | } |
| 114 | static inline void *kmalloc_node(size_t size, int flags, int node) | 114 | static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) |
| 115 | { | 115 | { |
| 116 | return kmalloc(size, flags); | 116 | return kmalloc(size, flags); |
| 117 | } | 117 | } |
diff --git a/include/linux/socket.h b/include/linux/socket.h index a5c7d96e4d2e..1739c2d5b95b 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -26,6 +26,13 @@ struct __kernel_sockaddr_storage { | |||
| 26 | #include <linux/types.h> /* pid_t */ | 26 | #include <linux/types.h> /* pid_t */ |
| 27 | #include <linux/compiler.h> /* __user */ | 27 | #include <linux/compiler.h> /* __user */ |
| 28 | 28 | ||
| 29 | extern int sysctl_somaxconn; | ||
| 30 | extern void sock_init(void); | ||
| 31 | #ifdef CONFIG_PROC_FS | ||
| 32 | struct seq_file; | ||
| 33 | extern void socket_seq_show(struct seq_file *seq); | ||
| 34 | #endif | ||
| 35 | |||
| 29 | typedef unsigned short sa_family_t; | 36 | typedef unsigned short sa_family_t; |
| 30 | 37 | ||
| 31 | /* | 38 | /* |
| @@ -271,6 +278,8 @@ struct ucred { | |||
| 271 | #define SOL_IRDA 266 | 278 | #define SOL_IRDA 266 |
| 272 | #define SOL_NETBEUI 267 | 279 | #define SOL_NETBEUI 267 |
| 273 | #define SOL_LLC 268 | 280 | #define SOL_LLC 268 |
| 281 | #define SOL_DCCP 269 | ||
| 282 | #define SOL_NETLINK 270 | ||
| 274 | 283 | ||
| 275 | /* IPX options */ | 284 | /* IPX options */ |
| 276 | #define IPX_TYPE 1 | 285 | #define IPX_TYPE 1 |
diff --git a/include/linux/sound.h b/include/linux/sound.h index 428f59794f48..72b9af4c3fd4 100644 --- a/include/linux/sound.h +++ b/include/linux/sound.h | |||
| @@ -29,7 +29,9 @@ | |||
| 29 | * Sound core interface functions | 29 | * Sound core interface functions |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | struct device; | ||
| 32 | extern int register_sound_special(struct file_operations *fops, int unit); | 33 | extern int register_sound_special(struct file_operations *fops, int unit); |
| 34 | extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); | ||
| 33 | extern int register_sound_mixer(struct file_operations *fops, int dev); | 35 | extern int register_sound_mixer(struct file_operations *fops, int dev); |
| 34 | extern int register_sound_midi(struct file_operations *fops, int dev); | 36 | extern int register_sound_midi(struct file_operations *fops, int dev); |
| 35 | extern int register_sound_dsp(struct file_operations *fops, int dev); | 37 | extern int register_sound_dsp(struct file_operations *fops, int dev); |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 34ec3e8d99b3..23448d0fb5bc 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
| @@ -177,6 +177,7 @@ typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem); | |||
| 177 | struct xdr_array2_desc { | 177 | struct xdr_array2_desc { |
| 178 | unsigned int elem_size; | 178 | unsigned int elem_size; |
| 179 | unsigned int array_len; | 179 | unsigned int array_len; |
| 180 | unsigned int array_maxlen; | ||
| 180 | xdr_xcode_elem_t xcode; | 181 | xdr_xcode_elem_t xcode; |
| 181 | }; | 182 | }; |
| 182 | 183 | ||
diff --git a/include/linux/swap.h b/include/linux/swap.h index c75954f2d868..3c9ff0048153 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -7,6 +7,7 @@ | |||
| 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 | |||
| 10 | #include <asm/atomic.h> | 11 | #include <asm/atomic.h> |
| 11 | #include <asm/page.h> | 12 | #include <asm/page.h> |
| 12 | 13 | ||
| @@ -106,6 +107,8 @@ enum { | |||
| 106 | SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ | 107 | SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ |
| 107 | SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ | 108 | SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ |
| 108 | SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), | 109 | SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), |
| 110 | /* add others here before... */ | ||
| 111 | SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ | ||
| 109 | }; | 112 | }; |
| 110 | 113 | ||
| 111 | #define SWAP_CLUSTER_MAX 32 | 114 | #define SWAP_CLUSTER_MAX 32 |
| @@ -115,16 +118,13 @@ enum { | |||
| 115 | 118 | ||
| 116 | /* | 119 | /* |
| 117 | * The in-memory structure used to track swap areas. | 120 | * The in-memory structure used to track swap areas. |
| 118 | * extent_list.prev points at the lowest-index extent. That list is | ||
| 119 | * sorted. | ||
| 120 | */ | 121 | */ |
| 121 | struct swap_info_struct { | 122 | struct swap_info_struct { |
| 122 | unsigned int flags; | 123 | unsigned int flags; |
| 123 | spinlock_t sdev_lock; | 124 | int prio; /* swap priority */ |
| 124 | struct file *swap_file; | 125 | struct file *swap_file; |
| 125 | struct block_device *bdev; | 126 | struct block_device *bdev; |
| 126 | struct list_head extent_list; | 127 | struct list_head extent_list; |
| 127 | int nr_extents; | ||
| 128 | struct swap_extent *curr_swap_extent; | 128 | struct swap_extent *curr_swap_extent; |
| 129 | unsigned old_block_size; | 129 | unsigned old_block_size; |
| 130 | unsigned short * swap_map; | 130 | unsigned short * swap_map; |
| @@ -132,10 +132,9 @@ struct swap_info_struct { | |||
| 132 | unsigned int highest_bit; | 132 | unsigned int highest_bit; |
| 133 | unsigned int cluster_next; | 133 | unsigned int cluster_next; |
| 134 | unsigned int cluster_nr; | 134 | unsigned int cluster_nr; |
| 135 | int prio; /* swap priority */ | 135 | unsigned int pages; |
| 136 | int pages; | 136 | unsigned int max; |
| 137 | unsigned long max; | 137 | unsigned int inuse_pages; |
| 138 | unsigned long inuse_pages; | ||
| 139 | int next; /* next entry on swap list */ | 138 | int next; /* next entry on swap list */ |
| 140 | }; | 139 | }; |
| 141 | 140 | ||
| @@ -221,13 +220,7 @@ extern int can_share_swap_page(struct page *); | |||
| 221 | extern int remove_exclusive_swap_page(struct page *); | 220 | extern int remove_exclusive_swap_page(struct page *); |
| 222 | struct backing_dev_info; | 221 | struct backing_dev_info; |
| 223 | 222 | ||
| 224 | extern struct swap_list_t swap_list; | 223 | extern spinlock_t swap_lock; |
| 225 | extern spinlock_t swaplock; | ||
| 226 | |||
| 227 | #define swap_list_lock() spin_lock(&swaplock) | ||
| 228 | #define swap_list_unlock() spin_unlock(&swaplock) | ||
| 229 | #define swap_device_lock(p) spin_lock(&p->sdev_lock) | ||
| 230 | #define swap_device_unlock(p) spin_unlock(&p->sdev_lock) | ||
| 231 | 224 | ||
| 232 | /* linux/mm/thrash.c */ | 225 | /* linux/mm/thrash.c */ |
| 233 | extern struct mm_struct * swap_token_mm; | 226 | extern struct mm_struct * swap_token_mm; |
| @@ -253,6 +246,8 @@ static inline void put_swap_token(struct mm_struct *mm) | |||
| 253 | 246 | ||
| 254 | #define si_swapinfo(val) \ | 247 | #define si_swapinfo(val) \ |
| 255 | do { (val)->freeswap = (val)->totalswap = 0; } while (0) | 248 | do { (val)->freeswap = (val)->totalswap = 0; } while (0) |
| 249 | /* only sparc can not include linux/pagemap.h in this file | ||
| 250 | * so leave page_cache_release and release_pages undeclared... */ | ||
| 256 | #define free_page_and_swap_cache(page) \ | 251 | #define free_page_and_swap_cache(page) \ |
| 257 | page_cache_release(page) | 252 | page_cache_release(page) |
| 258 | #define free_pages_and_swap_cache(pages, nr) \ | 253 | #define free_pages_and_swap_cache(pages, nr) \ |
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d4c7db35e708..87b9d14c710d 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * the low-order bits. | 4 | * the low-order bits. |
| 5 | * | 5 | * |
| 6 | * We arrange the `type' and `offset' fields so that `type' is at the five | 6 | * We arrange the `type' and `offset' fields so that `type' is at the five |
| 7 | * high-order bits of the smp_entry_t and `offset' is right-aligned in the | 7 | * high-order bits of the swp_entry_t and `offset' is right-aligned in the |
| 8 | * remaining bits. | 8 | * remaining bits. |
| 9 | * | 9 | * |
| 10 | * swp_entry_t's are *never* stored anywhere in their arch-dependent format. | 10 | * swp_entry_t's are *never* stored anywhere in their arch-dependent format. |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 5b5f434ac9a0..e82be96d4906 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 | { |
| @@ -137,6 +145,7 @@ enum | |||
| 137 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ | 145 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ |
| 138 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ | 146 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ |
| 139 | KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ | 147 | KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ |
| 148 | KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ | ||
| 140 | }; | 149 | }; |
| 141 | 150 | ||
| 142 | 151 | ||
| @@ -676,6 +685,7 @@ enum | |||
| 676 | FS_XFS=17, /* struct: control xfs parameters */ | 685 | FS_XFS=17, /* struct: control xfs parameters */ |
| 677 | FS_AIO_NR=18, /* current system-wide number of aio requests */ | 686 | FS_AIO_NR=18, /* current system-wide number of aio requests */ |
| 678 | FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ | 687 | FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ |
| 688 | FS_INOTIFY=20, /* inotify submenu */ | ||
| 679 | }; | 689 | }; |
| 680 | 690 | ||
| 681 | /* /proc/sys/fs/quota/ */ | 691 | /* /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 bcb762d93123..081b1ee8516e 100644 --- a/include/linux/tc_ematch/tc_em_meta.h +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
| @@ -41,19 +41,14 @@ enum | |||
| 41 | TCF_META_ID_LOADAVG_1, | 41 | TCF_META_ID_LOADAVG_1, |
| 42 | TCF_META_ID_LOADAVG_2, | 42 | TCF_META_ID_LOADAVG_2, |
| 43 | TCF_META_ID_DEV, | 43 | TCF_META_ID_DEV, |
| 44 | TCF_META_ID_INDEV, | ||
| 45 | TCF_META_ID_REALDEV, | ||
| 46 | TCF_META_ID_PRIORITY, | 44 | TCF_META_ID_PRIORITY, |
| 47 | TCF_META_ID_PROTOCOL, | 45 | TCF_META_ID_PROTOCOL, |
| 48 | TCF_META_ID_SECURITY, /* obsolete */ | ||
| 49 | TCF_META_ID_PKTTYPE, | 46 | TCF_META_ID_PKTTYPE, |
| 50 | TCF_META_ID_PKTLEN, | 47 | TCF_META_ID_PKTLEN, |
| 51 | TCF_META_ID_DATALEN, | 48 | TCF_META_ID_DATALEN, |
| 52 | TCF_META_ID_MACLEN, | 49 | TCF_META_ID_MACLEN, |
| 53 | TCF_META_ID_NFMARK, | 50 | TCF_META_ID_NFMARK, |
| 54 | TCF_META_ID_TCINDEX, | 51 | TCF_META_ID_TCINDEX, |
| 55 | TCF_META_ID_TCVERDICT, | ||
| 56 | TCF_META_ID_TCCLASSID, | ||
| 57 | TCF_META_ID_RTCLASSID, | 52 | TCF_META_ID_RTCLASSID, |
| 58 | TCF_META_ID_RTIIF, | 53 | TCF_META_ID_RTIIF, |
| 59 | TCF_META_ID_SK_FAMILY, | 54 | TCF_META_ID_SK_FAMILY, |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index e4fd82e42104..ac4ca44c75ca 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -55,24 +55,6 @@ struct tcphdr { | |||
| 55 | __u16 urg_ptr; | 55 | __u16 urg_ptr; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | |||
| 59 | enum { | ||
| 60 | TCP_ESTABLISHED = 1, | ||
| 61 | TCP_SYN_SENT, | ||
| 62 | TCP_SYN_RECV, | ||
| 63 | TCP_FIN_WAIT1, | ||
| 64 | TCP_FIN_WAIT2, | ||
| 65 | TCP_TIME_WAIT, | ||
| 66 | TCP_CLOSE, | ||
| 67 | TCP_CLOSE_WAIT, | ||
| 68 | TCP_LAST_ACK, | ||
| 69 | TCP_LISTEN, | ||
| 70 | TCP_CLOSING, /* now a valid state */ | ||
| 71 | |||
| 72 | TCP_MAX_STATES /* Leave at the end! */ | ||
| 73 | }; | ||
| 74 | |||
| 75 | #define TCP_STATE_MASK 0xF | ||
| 76 | #define TCP_ACTION_FIN (1 << 7) | 58 | #define TCP_ACTION_FIN (1 << 7) |
| 77 | 59 | ||
| 78 | enum { | 60 | enum { |
| @@ -195,8 +177,9 @@ struct tcp_info | |||
| 195 | 177 | ||
| 196 | #include <linux/config.h> | 178 | #include <linux/config.h> |
| 197 | #include <linux/skbuff.h> | 179 | #include <linux/skbuff.h> |
| 198 | #include <linux/ip.h> | ||
| 199 | #include <net/sock.h> | 180 | #include <net/sock.h> |
| 181 | #include <net/inet_connection_sock.h> | ||
| 182 | #include <net/inet_timewait_sock.h> | ||
| 200 | 183 | ||
| 201 | /* This defines a selective acknowledgement block. */ | 184 | /* This defines a selective acknowledgement block. */ |
| 202 | struct tcp_sack_block { | 185 | struct tcp_sack_block { |
| @@ -236,8 +219,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | |||
| 236 | } | 219 | } |
| 237 | 220 | ||
| 238 | struct tcp_sock { | 221 | struct tcp_sock { |
| 239 | /* inet_sock has to be the first member of tcp_sock */ | 222 | /* inet_connection_sock has to be the first member of tcp_sock */ |
| 240 | struct inet_sock inet; | 223 | struct inet_connection_sock inet_conn; |
| 241 | int tcp_header_len; /* Bytes of tcp header to send */ | 224 | int tcp_header_len; /* Bytes of tcp header to send */ |
| 242 | 225 | ||
| 243 | /* | 226 | /* |
| @@ -258,19 +241,6 @@ struct tcp_sock { | |||
| 258 | __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 241 | __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
| 259 | __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 242 | __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
| 260 | __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ | 243 | __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ |
| 261 | struct tcp_bind_bucket *bind_hash; | ||
| 262 | /* Delayed ACK control data */ | ||
| 263 | struct { | ||
| 264 | __u8 pending; /* ACK is pending */ | ||
| 265 | __u8 quick; /* Scheduled number of quick acks */ | ||
| 266 | __u8 pingpong; /* The session is interactive */ | ||
| 267 | __u8 blocked; /* Delayed ACK was blocked by socket lock*/ | ||
| 268 | __u32 ato; /* Predicted tick of soft clock */ | ||
| 269 | unsigned long timeout; /* Currently scheduled timeout */ | ||
| 270 | __u32 lrcvtime; /* timestamp of last received data packet*/ | ||
| 271 | __u16 last_seg_size; /* Size of last incoming segment */ | ||
| 272 | __u16 rcv_mss; /* MSS used for delayed ACK decisions */ | ||
| 273 | } ack; | ||
| 274 | 244 | ||
| 275 | /* Data for direct copy to user */ | 245 | /* Data for direct copy to user */ |
| 276 | struct { | 246 | struct { |
| @@ -288,19 +258,15 @@ struct tcp_sock { | |||
| 288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 258 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ |
| 289 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ | 259 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ |
| 290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ | 260 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ |
| 291 | __u8 ca_state; /* State of fast-retransmit machine */ | ||
| 292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ | ||
| 293 | 261 | ||
| 294 | __u16 advmss; /* Advertised MSS */ | ||
| 295 | __u32 window_clamp; /* Maximal window to advertise */ | 262 | __u32 window_clamp; /* Maximal window to advertise */ |
| 296 | __u32 rcv_ssthresh; /* Current window clamp */ | 263 | __u32 rcv_ssthresh; /* Current window clamp */ |
| 297 | 264 | ||
| 298 | __u32 frto_highmark; /* snd_nxt when RTO occurred */ | 265 | __u32 frto_highmark; /* snd_nxt when RTO occurred */ |
| 299 | __u8 reordering; /* Packet reordering metric. */ | 266 | __u8 reordering; /* Packet reordering metric. */ |
| 300 | __u8 frto_counter; /* Number of new acks after RTO */ | 267 | __u8 frto_counter; /* Number of new acks after RTO */ |
| 301 | 268 | __u8 nonagle; /* Disable Nagle algorithm? */ | |
| 302 | __u8 unused; | 269 | __u8 keepalive_probes; /* num of allowed keep alive probes */ |
| 303 | __u8 defer_accept; /* User waits for some data after accept() */ | ||
| 304 | 270 | ||
| 305 | /* RTT measurement */ | 271 | /* RTT measurement */ |
| 306 | __u32 srtt; /* smoothed round trip time << 3 */ | 272 | __u32 srtt; /* smoothed round trip time << 3 */ |
| @@ -308,19 +274,13 @@ struct tcp_sock { | |||
| 308 | __u32 mdev_max; /* maximal mdev for the last rtt period */ | 274 | __u32 mdev_max; /* maximal mdev for the last rtt period */ |
| 309 | __u32 rttvar; /* smoothed mdev_max */ | 275 | __u32 rttvar; /* smoothed mdev_max */ |
| 310 | __u32 rtt_seq; /* sequence number to update rttvar */ | 276 | __u32 rtt_seq; /* sequence number to update rttvar */ |
| 311 | __u32 rto; /* retransmit timeout */ | ||
| 312 | 277 | ||
| 313 | __u32 packets_out; /* Packets which are "in flight" */ | 278 | __u32 packets_out; /* Packets which are "in flight" */ |
| 314 | __u32 left_out; /* Packets which leaved network */ | 279 | __u32 left_out; /* Packets which leaved network */ |
| 315 | __u32 retrans_out; /* Retransmitted packets out */ | 280 | __u32 retrans_out; /* Retransmitted packets out */ |
| 316 | __u8 backoff; /* backoff */ | ||
| 317 | /* | 281 | /* |
| 318 | * Options received (usually on last packet, some only on SYN packets). | 282 | * Options received (usually on last packet, some only on SYN packets). |
| 319 | */ | 283 | */ |
| 320 | __u8 nonagle; /* Disable Nagle algorithm? */ | ||
| 321 | __u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
| 322 | |||
| 323 | __u8 probes_out; /* unanswered 0 window probes */ | ||
| 324 | struct tcp_options_received rx_opt; | 284 | struct tcp_options_received rx_opt; |
| 325 | 285 | ||
| 326 | /* | 286 | /* |
| @@ -333,11 +293,6 @@ struct tcp_sock { | |||
| 333 | __u32 snd_cwnd_used; | 293 | __u32 snd_cwnd_used; |
| 334 | __u32 snd_cwnd_stamp; | 294 | __u32 snd_cwnd_stamp; |
| 335 | 295 | ||
| 336 | /* Two commonly used timers in both sender and receiver paths. */ | ||
| 337 | unsigned long timeout; | ||
| 338 | struct timer_list retransmit_timer; /* Resend (no ack) */ | ||
| 339 | struct timer_list delack_timer; /* Ack delay */ | ||
| 340 | |||
| 341 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 296 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
| 342 | 297 | ||
| 343 | struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ | 298 | struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ |
| @@ -352,8 +307,7 @@ struct tcp_sock { | |||
| 352 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 307 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
| 353 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ | 308 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ |
| 354 | 309 | ||
| 355 | __u8 syn_retries; /* num of allowed syn retries */ | 310 | __u16 advmss; /* Advertised MSS */ |
| 356 | __u8 ecn_flags; /* ECN status bits. */ | ||
| 357 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ | 311 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ |
| 358 | __u32 lost_out; /* Lost packets */ | 312 | __u32 lost_out; /* Lost packets */ |
| 359 | __u32 sacked_out; /* SACK'd packets */ | 313 | __u32 sacked_out; /* SACK'd packets */ |
| @@ -367,14 +321,12 @@ struct tcp_sock { | |||
| 367 | int undo_retrans; /* number of undoable retransmissions. */ | 321 | int undo_retrans; /* number of undoable retransmissions. */ |
| 368 | __u32 urg_seq; /* Seq of received urgent pointer */ | 322 | __u32 urg_seq; /* Seq of received urgent pointer */ |
| 369 | __u16 urg_data; /* Saved octet of OOB data and control flags */ | 323 | __u16 urg_data; /* Saved octet of OOB data and control flags */ |
| 370 | __u8 pending; /* Scheduled timer event */ | ||
| 371 | __u8 urg_mode; /* In urgent mode */ | 324 | __u8 urg_mode; /* In urgent mode */ |
| 325 | __u8 ecn_flags; /* ECN status bits. */ | ||
| 372 | __u32 snd_up; /* Urgent pointer */ | 326 | __u32 snd_up; /* Urgent pointer */ |
| 373 | 327 | ||
| 374 | __u32 total_retrans; /* Total retransmits for entire connection */ | 328 | __u32 total_retrans; /* Total retransmits for entire connection */ |
| 375 | 329 | ||
| 376 | struct request_sock_queue accept_queue; /* FIFO of established children */ | ||
| 377 | |||
| 378 | unsigned int keepalive_time; /* time before keep alive takes place */ | 330 | unsigned int keepalive_time; /* time before keep alive takes place */ |
| 379 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 331 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
| 380 | int linger2; | 332 | int linger2; |
| @@ -394,11 +346,6 @@ struct tcp_sock { | |||
| 394 | __u32 seq; | 346 | __u32 seq; |
| 395 | __u32 time; | 347 | __u32 time; |
| 396 | } rcvq_space; | 348 | } rcvq_space; |
| 397 | |||
| 398 | /* Pluggable TCP congestion control hook */ | ||
| 399 | struct tcp_congestion_ops *ca_ops; | ||
| 400 | u32 ca_priv[16]; | ||
| 401 | #define TCP_CA_PRIV_SIZE (16*sizeof(u32)) | ||
| 402 | }; | 349 | }; |
| 403 | 350 | ||
| 404 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 351 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
| @@ -406,9 +353,18 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk) | |||
| 406 | return (struct tcp_sock *)sk; | 353 | return (struct tcp_sock *)sk; |
| 407 | } | 354 | } |
| 408 | 355 | ||
| 409 | static inline void *tcp_ca(const struct tcp_sock *tp) | 356 | struct tcp_timewait_sock { |
| 357 | struct inet_timewait_sock tw_sk; | ||
| 358 | __u32 tw_rcv_nxt; | ||
| 359 | __u32 tw_snd_nxt; | ||
| 360 | __u32 tw_rcv_wnd; | ||
| 361 | __u32 tw_ts_recent; | ||
| 362 | long tw_ts_recent_stamp; | ||
| 363 | }; | ||
| 364 | |||
| 365 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | ||
| 410 | { | 366 | { |
| 411 | return (void *) tp->ca_priv; | 367 | return (struct tcp_timewait_sock *)sk; |
| 412 | } | 368 | } |
| 413 | 369 | ||
| 414 | #endif | 370 | #endif |
diff --git a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h deleted file mode 100644 index 7a5996743946..000000000000 --- a/include/linux/tcp_diag.h +++ /dev/null | |||
| @@ -1,127 +0,0 @@ | |||
| 1 | #ifndef _TCP_DIAG_H_ | ||
| 2 | #define _TCP_DIAG_H_ 1 | ||
| 3 | |||
| 4 | /* Just some random number */ | ||
| 5 | #define TCPDIAG_GETSOCK 18 | ||
| 6 | |||
| 7 | /* Socket identity */ | ||
| 8 | struct tcpdiag_sockid | ||
| 9 | { | ||
| 10 | __u16 tcpdiag_sport; | ||
| 11 | __u16 tcpdiag_dport; | ||
| 12 | __u32 tcpdiag_src[4]; | ||
| 13 | __u32 tcpdiag_dst[4]; | ||
| 14 | __u32 tcpdiag_if; | ||
| 15 | __u32 tcpdiag_cookie[2]; | ||
| 16 | #define TCPDIAG_NOCOOKIE (~0U) | ||
| 17 | }; | ||
| 18 | |||
| 19 | /* Request structure */ | ||
| 20 | |||
| 21 | struct tcpdiagreq | ||
| 22 | { | ||
| 23 | __u8 tcpdiag_family; /* Family of addresses. */ | ||
| 24 | __u8 tcpdiag_src_len; | ||
| 25 | __u8 tcpdiag_dst_len; | ||
| 26 | __u8 tcpdiag_ext; /* Query extended information */ | ||
| 27 | |||
| 28 | struct tcpdiag_sockid id; | ||
| 29 | |||
| 30 | __u32 tcpdiag_states; /* States to dump */ | ||
| 31 | __u32 tcpdiag_dbs; /* Tables to dump (NI) */ | ||
| 32 | }; | ||
| 33 | |||
| 34 | enum | ||
| 35 | { | ||
| 36 | TCPDIAG_REQ_NONE, | ||
| 37 | TCPDIAG_REQ_BYTECODE, | ||
| 38 | }; | ||
| 39 | |||
| 40 | #define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE | ||
| 41 | |||
| 42 | /* Bytecode is sequence of 4 byte commands followed by variable arguments. | ||
| 43 | * All the commands identified by "code" are conditional jumps forward: | ||
| 44 | * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be | ||
| 45 | * length of the command and its arguments. | ||
| 46 | */ | ||
| 47 | |||
| 48 | struct tcpdiag_bc_op | ||
| 49 | { | ||
| 50 | unsigned char code; | ||
| 51 | unsigned char yes; | ||
| 52 | unsigned short no; | ||
| 53 | }; | ||
| 54 | |||
| 55 | enum | ||
| 56 | { | ||
| 57 | TCPDIAG_BC_NOP, | ||
| 58 | TCPDIAG_BC_JMP, | ||
| 59 | TCPDIAG_BC_S_GE, | ||
| 60 | TCPDIAG_BC_S_LE, | ||
| 61 | TCPDIAG_BC_D_GE, | ||
| 62 | TCPDIAG_BC_D_LE, | ||
| 63 | TCPDIAG_BC_AUTO, | ||
| 64 | TCPDIAG_BC_S_COND, | ||
| 65 | TCPDIAG_BC_D_COND, | ||
| 66 | }; | ||
| 67 | |||
| 68 | struct tcpdiag_hostcond | ||
| 69 | { | ||
| 70 | __u8 family; | ||
| 71 | __u8 prefix_len; | ||
| 72 | int port; | ||
| 73 | __u32 addr[0]; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | ||
| 77 | * and, alas, the information shown by netstat. */ | ||
| 78 | struct tcpdiagmsg | ||
| 79 | { | ||
| 80 | __u8 tcpdiag_family; | ||
| 81 | __u8 tcpdiag_state; | ||
| 82 | __u8 tcpdiag_timer; | ||
| 83 | __u8 tcpdiag_retrans; | ||
| 84 | |||
| 85 | struct tcpdiag_sockid id; | ||
| 86 | |||
| 87 | __u32 tcpdiag_expires; | ||
| 88 | __u32 tcpdiag_rqueue; | ||
| 89 | __u32 tcpdiag_wqueue; | ||
| 90 | __u32 tcpdiag_uid; | ||
| 91 | __u32 tcpdiag_inode; | ||
| 92 | }; | ||
| 93 | |||
| 94 | /* Extensions */ | ||
| 95 | |||
| 96 | enum | ||
| 97 | { | ||
| 98 | TCPDIAG_NONE, | ||
| 99 | TCPDIAG_MEMINFO, | ||
| 100 | TCPDIAG_INFO, | ||
| 101 | TCPDIAG_VEGASINFO, | ||
| 102 | TCPDIAG_CONG, | ||
| 103 | }; | ||
| 104 | |||
| 105 | #define TCPDIAG_MAX TCPDIAG_CONG | ||
| 106 | |||
| 107 | |||
| 108 | /* TCPDIAG_MEM */ | ||
| 109 | |||
| 110 | struct tcpdiag_meminfo | ||
| 111 | { | ||
| 112 | __u32 tcpdiag_rmem; | ||
| 113 | __u32 tcpdiag_wmem; | ||
| 114 | __u32 tcpdiag_fmem; | ||
| 115 | __u32 tcpdiag_tmem; | ||
| 116 | }; | ||
| 117 | |||
| 118 | /* TCPDIAG_VEGASINFO */ | ||
| 119 | |||
| 120 | struct tcpvegas_info { | ||
| 121 | __u32 tcpv_enabled; | ||
| 122 | __u32 tcpv_rttcnt; | ||
| 123 | __u32 tcpv_rtt; | ||
| 124 | __u32 tcpv_minrtt; | ||
| 125 | }; | ||
| 126 | |||
| 127 | #endif /* _TCP_DIAG_H_ */ | ||
diff --git a/include/linux/types.h b/include/linux/types.h index dcb13f865df9..2b678c22ca4a 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
| @@ -123,6 +123,9 @@ typedef __u64 u_int64_t; | |||
| 123 | typedef __s64 int64_t; | 123 | typedef __s64 int64_t; |
| 124 | #endif | 124 | #endif |
| 125 | 125 | ||
| 126 | /* this is a special 64bit data type that is 8-byte aligned */ | ||
| 127 | #define aligned_u64 unsigned long long __attribute__((aligned(8))) | ||
| 128 | |||
| 126 | /* | 129 | /* |
| 127 | * The type used for indexing onto a disc or disc partition. | 130 | * The type used for indexing onto a disc or disc partition. |
| 128 | * If required, asm/types.h can override it and define | 131 | * If required, asm/types.h can override it and define |
diff --git a/include/linux/uinput.h b/include/linux/uinput.h index 4c2c82336d10..84876077027f 100644 --- a/include/linux/uinput.h +++ b/include/linux/uinput.h | |||
| @@ -42,8 +42,7 @@ struct uinput_request { | |||
| 42 | int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ | 42 | int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ |
| 43 | 43 | ||
| 44 | int retval; | 44 | int retval; |
| 45 | wait_queue_head_t waitq; | 45 | struct completion done; |
| 46 | int completed; | ||
| 47 | 46 | ||
| 48 | union { | 47 | union { |
| 49 | int effect_id; | 48 | int effect_id; |
| @@ -62,7 +61,7 @@ struct uinput_device { | |||
| 62 | 61 | ||
| 63 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; | 62 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; |
| 64 | wait_queue_head_t requests_waitq; | 63 | wait_queue_head_t requests_waitq; |
| 65 | struct semaphore requests_sem; | 64 | spinlock_t requests_lock; |
| 66 | }; | 65 | }; |
| 67 | #endif /* __KERNEL__ */ | 66 | #endif /* __KERNEL__ */ |
| 68 | 67 | ||
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/usb_input.h b/include/linux/usb_input.h new file mode 100644 index 000000000000..716e0cc16043 --- /dev/null +++ b/include/linux/usb_input.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef __USB_INPUT_H | ||
| 2 | #define __USB_INPUT_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005 Dmitry Torokhov | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/usb.h> | ||
| 13 | #include <linux/input.h> | ||
| 14 | #include <asm/byteorder.h> | ||
| 15 | |||
| 16 | static inline void | ||
| 17 | usb_to_input_id(const struct usb_device *dev, struct input_id *id) | ||
| 18 | { | ||
| 19 | id->bustype = BUS_USB; | ||
| 20 | id->vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 21 | id->product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 22 | id->version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 23 | } | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 6409d9cf5965..b244f69ef682 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
| @@ -10,6 +10,14 @@ | |||
| 10 | #define VM_MAP 0x00000004 /* vmap()ed pages */ | 10 | #define VM_MAP 0x00000004 /* vmap()ed pages */ |
| 11 | /* bits [20..32] reserved for arch specific ioremap internals */ | 11 | /* bits [20..32] reserved for arch specific ioremap internals */ |
| 12 | 12 | ||
| 13 | /* | ||
| 14 | * Maximum alignment for ioremap() regions. | ||
| 15 | * Can be overriden by arch-specific value. | ||
| 16 | */ | ||
| 17 | #ifndef IOREMAP_MAX_ORDER | ||
| 18 | #define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */ | ||
| 19 | #endif | ||
| 20 | |||
| 13 | struct vm_struct { | 21 | struct vm_struct { |
| 14 | void *addr; | 22 | void *addr; |
| 15 | unsigned long size; | 23 | unsigned long size; |
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 | ||
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 88ba0d29f8c8..1192ed8f4fe8 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
| @@ -47,4 +47,14 @@ struct watchdog_info { | |||
| 47 | #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ | 47 | #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ |
| 48 | #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ | 48 | #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ |
| 49 | 49 | ||
| 50 | #ifdef __KERNEL__ | ||
| 51 | |||
| 52 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | ||
| 53 | #define WATCHDOG_NOWAYOUT 1 | ||
| 54 | #else | ||
| 55 | #define WATCHDOG_NOWAYOUT 0 | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #endif /* __KERNEL__ */ | ||
| 59 | |||
| 50 | #endif /* ifndef _LINUX_WATCHDOG_H */ | 60 | #endif /* ifndef _LINUX_WATCHDOG_H */ |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index f0d423300d84..0fb077d68441 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
| @@ -258,9 +258,27 @@ struct xfrm_usersa_flush { | |||
| 258 | __u8 proto; | 258 | __u8 proto; |
| 259 | }; | 259 | }; |
| 260 | 260 | ||
| 261 | #ifndef __KERNEL__ | ||
| 262 | /* backwards compatibility for userspace */ | ||
| 261 | #define XFRMGRP_ACQUIRE 1 | 263 | #define XFRMGRP_ACQUIRE 1 |
| 262 | #define XFRMGRP_EXPIRE 2 | 264 | #define XFRMGRP_EXPIRE 2 |
| 263 | #define XFRMGRP_SA 4 | 265 | #define XFRMGRP_SA 4 |
| 264 | #define XFRMGRP_POLICY 8 | 266 | #define XFRMGRP_POLICY 8 |
| 267 | #endif | ||
| 268 | |||
| 269 | enum xfrm_nlgroups { | ||
| 270 | XFRMNLGRP_NONE, | ||
| 271 | #define XFRMNLGRP_NONE XFRMNLGRP_NONE | ||
| 272 | XFRMNLGRP_ACQUIRE, | ||
| 273 | #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE | ||
| 274 | XFRMNLGRP_EXPIRE, | ||
| 275 | #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE | ||
| 276 | XFRMNLGRP_SA, | ||
| 277 | #define XFRMNLGRP_SA XFRMNLGRP_SA | ||
| 278 | XFRMNLGRP_POLICY, | ||
| 279 | #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY | ||
| 280 | __XFRMNLGRP_MAX | ||
| 281 | }; | ||
| 282 | #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) | ||
| 265 | 283 | ||
| 266 | #endif /* _LINUX_XFRM_H */ | 284 | #endif /* _LINUX_XFRM_H */ |
diff --git a/include/linux/zlib.h b/include/linux/zlib.h index 850076ea14d3..74f7b78c22d2 100644 --- a/include/linux/zlib.h +++ b/include/linux/zlib.h | |||
| @@ -506,6 +506,11 @@ extern int zlib_deflateReset (z_streamp strm); | |||
| 506 | stream state was inconsistent (such as zalloc or state being NULL). | 506 | stream state was inconsistent (such as zalloc or state being NULL). |
| 507 | */ | 507 | */ |
| 508 | 508 | ||
| 509 | static inline unsigned long deflateBound(unsigned long s) | ||
| 510 | { | ||
| 511 | return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; | ||
| 512 | } | ||
| 513 | |||
| 509 | extern int zlib_deflateParams (z_streamp strm, int level, int strategy); | 514 | extern int zlib_deflateParams (z_streamp strm, int level, int strategy); |
| 510 | /* | 515 | /* |
| 511 | Dynamically update the compression level and compression strategy. The | 516 | Dynamically update the compression level and compression strategy. The |
