diff options
Diffstat (limited to 'include/linux')
56 files changed, 1997 insertions, 419 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 6617c9f8f2ca..cb79b7a208e1 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #ifndef __LINUX_ATA_H__ | 29 | #ifndef __LINUX_ATA_H__ |
30 | #define __LINUX_ATA_H__ | 30 | #define __LINUX_ATA_H__ |
31 | 31 | ||
32 | #include <linux/kernel.h> | ||
33 | #include <linux/string.h> | ||
32 | #include <linux/types.h> | 34 | #include <linux/types.h> |
33 | #include <asm/byteorder.h> | 35 | #include <asm/byteorder.h> |
34 | 36 | ||
@@ -91,6 +93,7 @@ enum { | |||
91 | ATA_ID_CFA_POWER = 160, | 93 | ATA_ID_CFA_POWER = 160, |
92 | ATA_ID_CFA_KEY_MGMT = 162, | 94 | ATA_ID_CFA_KEY_MGMT = 162, |
93 | ATA_ID_CFA_MODES = 163, | 95 | ATA_ID_CFA_MODES = 163, |
96 | ATA_ID_DATA_SET_MGMT = 169, | ||
94 | ATA_ID_ROT_SPEED = 217, | 97 | ATA_ID_ROT_SPEED = 217, |
95 | ATA_ID_PIO4 = (1 << 1), | 98 | ATA_ID_PIO4 = (1 << 1), |
96 | 99 | ||
@@ -248,6 +251,7 @@ enum { | |||
248 | ATA_CMD_SMART = 0xB0, | 251 | ATA_CMD_SMART = 0xB0, |
249 | ATA_CMD_MEDIA_LOCK = 0xDE, | 252 | ATA_CMD_MEDIA_LOCK = 0xDE, |
250 | ATA_CMD_MEDIA_UNLOCK = 0xDF, | 253 | ATA_CMD_MEDIA_UNLOCK = 0xDF, |
254 | ATA_CMD_DSM = 0x06, | ||
251 | /* marked obsolete in the ATA/ATAPI-7 spec */ | 255 | /* marked obsolete in the ATA/ATAPI-7 spec */ |
252 | ATA_CMD_RESTORE = 0x10, | 256 | ATA_CMD_RESTORE = 0x10, |
253 | 257 | ||
@@ -321,6 +325,9 @@ enum { | |||
321 | ATA_SMART_READ_VALUES = 0xD0, | 325 | ATA_SMART_READ_VALUES = 0xD0, |
322 | ATA_SMART_READ_THRESHOLDS = 0xD1, | 326 | ATA_SMART_READ_THRESHOLDS = 0xD1, |
323 | 327 | ||
328 | /* feature values for Data Set Management */ | ||
329 | ATA_DSM_TRIM = 0x01, | ||
330 | |||
324 | /* password used in LBA Mid / LBA High for executing SMART commands */ | 331 | /* password used in LBA Mid / LBA High for executing SMART commands */ |
325 | ATA_SMART_LBAM_PASS = 0x4F, | 332 | ATA_SMART_LBAM_PASS = 0x4F, |
326 | ATA_SMART_LBAH_PASS = 0xC2, | 333 | ATA_SMART_LBAH_PASS = 0xC2, |
@@ -723,6 +730,14 @@ static inline int ata_id_has_unload(const u16 *id) | |||
723 | return 0; | 730 | return 0; |
724 | } | 731 | } |
725 | 732 | ||
733 | static inline int ata_id_has_trim(const u16 *id) | ||
734 | { | ||
735 | if (ata_id_major_version(id) >= 7 && | ||
736 | (id[ATA_ID_DATA_SET_MGMT] & 1)) | ||
737 | return 1; | ||
738 | return 0; | ||
739 | } | ||
740 | |||
726 | static inline int ata_id_current_chs_valid(const u16 *id) | 741 | static inline int ata_id_current_chs_valid(const u16 *id) |
727 | { | 742 | { |
728 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 743 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -863,6 +878,32 @@ static inline void ata_id_to_hd_driveid(u16 *id) | |||
863 | #endif | 878 | #endif |
864 | } | 879 | } |
865 | 880 | ||
881 | /* | ||
882 | * Write up to 'max' LBA Range Entries to the buffer that will cover the | ||
883 | * extent from sector to sector + count. This is used for TRIM and for | ||
884 | * ADD LBA(S) TO NV CACHE PINNED SET. | ||
885 | */ | ||
886 | static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max, | ||
887 | u64 sector, unsigned long count) | ||
888 | { | ||
889 | __le64 *buffer = _buffer; | ||
890 | unsigned i = 0; | ||
891 | |||
892 | while (i < max) { | ||
893 | u64 entry = sector | | ||
894 | ((u64)(count > 0xffff ? 0xffff : count) << 48); | ||
895 | buffer[i++] = __cpu_to_le64(entry); | ||
896 | if (count <= 0xffff) | ||
897 | break; | ||
898 | count -= 0xffff; | ||
899 | sector += 0xffff; | ||
900 | } | ||
901 | |||
902 | max = ALIGN(i * 8, 512); | ||
903 | memset(buffer + i, 0, max - i * 8); | ||
904 | return max; | ||
905 | } | ||
906 | |||
866 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 907 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
867 | { | 908 | { |
868 | return (tf->command == ATA_CMD_READ_MULTI) || | 909 | return (tf->command == ATA_CMD_READ_MULTI) || |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index bee52abb8a4d..0ec2c594868e 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -24,8 +24,8 @@ struct dentry; | |||
24 | */ | 24 | */ |
25 | enum bdi_state { | 25 | enum bdi_state { |
26 | BDI_pdflush, /* A pdflush thread is working this device */ | 26 | BDI_pdflush, /* A pdflush thread is working this device */ |
27 | BDI_write_congested, /* The write queue is getting full */ | 27 | BDI_async_congested, /* The async (write) queue is getting full */ |
28 | BDI_read_congested, /* The read queue is getting full */ | 28 | BDI_sync_congested, /* The sync queue is getting full */ |
29 | BDI_unused, /* Available bits start here */ | 29 | BDI_unused, /* Available bits start here */ |
30 | }; | 30 | }; |
31 | 31 | ||
@@ -215,18 +215,18 @@ static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) | |||
215 | 215 | ||
216 | static inline int bdi_read_congested(struct backing_dev_info *bdi) | 216 | static inline int bdi_read_congested(struct backing_dev_info *bdi) |
217 | { | 217 | { |
218 | return bdi_congested(bdi, 1 << BDI_read_congested); | 218 | return bdi_congested(bdi, 1 << BDI_sync_congested); |
219 | } | 219 | } |
220 | 220 | ||
221 | static inline int bdi_write_congested(struct backing_dev_info *bdi) | 221 | static inline int bdi_write_congested(struct backing_dev_info *bdi) |
222 | { | 222 | { |
223 | return bdi_congested(bdi, 1 << BDI_write_congested); | 223 | return bdi_congested(bdi, 1 << BDI_async_congested); |
224 | } | 224 | } |
225 | 225 | ||
226 | static inline int bdi_rw_congested(struct backing_dev_info *bdi) | 226 | static inline int bdi_rw_congested(struct backing_dev_info *bdi) |
227 | { | 227 | { |
228 | return bdi_congested(bdi, (1 << BDI_read_congested)| | 228 | return bdi_congested(bdi, (1 << BDI_sync_congested) | |
229 | (1 << BDI_write_congested)); | 229 | (1 << BDI_async_congested)); |
230 | } | 230 | } |
231 | 231 | ||
232 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); | 232 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); |
diff --git a/include/linux/bio.h b/include/linux/bio.h index b05b1d4d17d2..b900d2c67d29 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -145,20 +145,21 @@ struct bio { | |||
145 | * bit 2 -- barrier | 145 | * bit 2 -- barrier |
146 | * Insert a serialization point in the IO queue, forcing previously | 146 | * Insert a serialization point in the IO queue, forcing previously |
147 | * submitted IO to be completed before this one is issued. | 147 | * submitted IO to be completed before this one is issued. |
148 | * bit 3 -- synchronous I/O hint: the block layer will unplug immediately | 148 | * bit 3 -- synchronous I/O hint. |
149 | * Note that this does NOT indicate that the IO itself is sync, just | 149 | * bit 4 -- Unplug the device immediately after submitting this bio. |
150 | * that the block layer will not postpone issue of this IO by plugging. | 150 | * bit 5 -- metadata request |
151 | * bit 4 -- metadata request | ||
152 | * Used for tracing to differentiate metadata and data IO. May also | 151 | * Used for tracing to differentiate metadata and data IO. May also |
153 | * get some preferential treatment in the IO scheduler | 152 | * get some preferential treatment in the IO scheduler |
154 | * bit 5 -- discard sectors | 153 | * bit 6 -- discard sectors |
155 | * Informs the lower level device that this range of sectors is no longer | 154 | * Informs the lower level device that this range of sectors is no longer |
156 | * used by the file system and may thus be freed by the device. Used | 155 | * used by the file system and may thus be freed by the device. Used |
157 | * for flash based storage. | 156 | * for flash based storage. |
158 | * bit 6 -- fail fast device errors | 157 | * bit 7 -- fail fast device errors |
159 | * bit 7 -- fail fast transport errors | 158 | * bit 8 -- fail fast transport errors |
160 | * bit 8 -- fail fast driver errors | 159 | * bit 9 -- fail fast driver errors |
161 | * Don't want driver retries for any fast fail whatever the reason. | 160 | * Don't want driver retries for any fast fail whatever the reason. |
161 | * bit 10 -- Tell the IO scheduler not to wait for more requests after this | ||
162 | one has been submitted, even if it is a SYNC request. | ||
162 | */ | 163 | */ |
163 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ | 164 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ |
164 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ | 165 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ |
@@ -170,6 +171,7 @@ struct bio { | |||
170 | #define BIO_RW_FAILFAST_DEV 7 | 171 | #define BIO_RW_FAILFAST_DEV 7 |
171 | #define BIO_RW_FAILFAST_TRANSPORT 8 | 172 | #define BIO_RW_FAILFAST_TRANSPORT 8 |
172 | #define BIO_RW_FAILFAST_DRIVER 9 | 173 | #define BIO_RW_FAILFAST_DRIVER 9 |
174 | #define BIO_RW_NOIDLE 10 | ||
173 | 175 | ||
174 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) | 176 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) |
175 | 177 | ||
@@ -188,6 +190,7 @@ struct bio { | |||
188 | #define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) | 190 | #define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) |
189 | #define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META) | 191 | #define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META) |
190 | #define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) | 192 | #define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) |
193 | #define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE) | ||
191 | 194 | ||
192 | /* | 195 | /* |
193 | * upper 16 bits of bi_rw define the io priority of this bio | 196 | * upper 16 bits of bi_rw define the io priority of this bio |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 465d6babc847..ba54c834a590 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -38,6 +38,10 @@ struct request; | |||
38 | typedef void (rq_end_io_fn)(struct request *, int); | 38 | typedef void (rq_end_io_fn)(struct request *, int); |
39 | 39 | ||
40 | struct request_list { | 40 | struct request_list { |
41 | /* | ||
42 | * count[], starved[], and wait[] are indexed by | ||
43 | * BLK_RW_SYNC/BLK_RW_ASYNC | ||
44 | */ | ||
41 | int count[2]; | 45 | int count[2]; |
42 | int starved[2]; | 46 | int starved[2]; |
43 | int elvpriv; | 47 | int elvpriv; |
@@ -66,6 +70,11 @@ enum rq_cmd_type_bits { | |||
66 | REQ_TYPE_ATA_PC, | 70 | REQ_TYPE_ATA_PC, |
67 | }; | 71 | }; |
68 | 72 | ||
73 | enum { | ||
74 | BLK_RW_ASYNC = 0, | ||
75 | BLK_RW_SYNC = 1, | ||
76 | }; | ||
77 | |||
69 | /* | 78 | /* |
70 | * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being | 79 | * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being |
71 | * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a | 80 | * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a |
@@ -103,12 +112,12 @@ enum rq_flag_bits { | |||
103 | __REQ_QUIET, /* don't worry about errors */ | 112 | __REQ_QUIET, /* don't worry about errors */ |
104 | __REQ_PREEMPT, /* set for "ide_preempt" requests */ | 113 | __REQ_PREEMPT, /* set for "ide_preempt" requests */ |
105 | __REQ_ORDERED_COLOR, /* is before or after barrier */ | 114 | __REQ_ORDERED_COLOR, /* is before or after barrier */ |
106 | __REQ_RW_SYNC, /* request is sync (O_DIRECT) */ | 115 | __REQ_RW_SYNC, /* request is sync (sync write or read) */ |
107 | __REQ_ALLOCED, /* request came from our alloc pool */ | 116 | __REQ_ALLOCED, /* request came from our alloc pool */ |
108 | __REQ_RW_META, /* metadata io request */ | 117 | __REQ_RW_META, /* metadata io request */ |
109 | __REQ_COPY_USER, /* contains copies of user pages */ | 118 | __REQ_COPY_USER, /* contains copies of user pages */ |
110 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ | 119 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ |
111 | __REQ_UNPLUG, /* unplug queue on submission */ | 120 | __REQ_NOIDLE, /* Don't anticipate more IO after this one */ |
112 | __REQ_NR_BITS, /* stops here */ | 121 | __REQ_NR_BITS, /* stops here */ |
113 | }; | 122 | }; |
114 | 123 | ||
@@ -135,7 +144,7 @@ enum rq_flag_bits { | |||
135 | #define REQ_RW_META (1 << __REQ_RW_META) | 144 | #define REQ_RW_META (1 << __REQ_RW_META) |
136 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) | 145 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) |
137 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | 146 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) |
138 | #define REQ_UNPLUG (1 << __REQ_UNPLUG) | 147 | #define REQ_NOIDLE (1 << __REQ_NOIDLE) |
139 | 148 | ||
140 | #define BLK_MAX_CDB 16 | 149 | #define BLK_MAX_CDB 16 |
141 | 150 | ||
@@ -438,8 +447,8 @@ struct request_queue | |||
438 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ | 447 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ |
439 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ | 448 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
440 | #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ | 449 | #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ |
441 | #define QUEUE_FLAG_READFULL 3 /* read queue has been filled */ | 450 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ |
442 | #define QUEUE_FLAG_WRITEFULL 4 /* write queue has been filled */ | 451 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ |
443 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ | 452 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ |
444 | #define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ | 453 | #define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ |
445 | #define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ | 454 | #define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ |
@@ -611,32 +620,42 @@ enum { | |||
611 | #define rq_data_dir(rq) ((rq)->cmd_flags & 1) | 620 | #define rq_data_dir(rq) ((rq)->cmd_flags & 1) |
612 | 621 | ||
613 | /* | 622 | /* |
614 | * We regard a request as sync, if it's a READ or a SYNC write. | 623 | * We regard a request as sync, if either a read or a sync write |
615 | */ | 624 | */ |
616 | #define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC) | 625 | static inline bool rw_is_sync(unsigned int rw_flags) |
626 | { | ||
627 | return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); | ||
628 | } | ||
629 | |||
630 | static inline bool rq_is_sync(struct request *rq) | ||
631 | { | ||
632 | return rw_is_sync(rq->cmd_flags); | ||
633 | } | ||
634 | |||
617 | #define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) | 635 | #define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) |
636 | #define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE) | ||
618 | 637 | ||
619 | static inline int blk_queue_full(struct request_queue *q, int rw) | 638 | static inline int blk_queue_full(struct request_queue *q, int sync) |
620 | { | 639 | { |
621 | if (rw == READ) | 640 | if (sync) |
622 | return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags); | 641 | return test_bit(QUEUE_FLAG_SYNCFULL, &q->queue_flags); |
623 | return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); | 642 | return test_bit(QUEUE_FLAG_ASYNCFULL, &q->queue_flags); |
624 | } | 643 | } |
625 | 644 | ||
626 | static inline void blk_set_queue_full(struct request_queue *q, int rw) | 645 | static inline void blk_set_queue_full(struct request_queue *q, int sync) |
627 | { | 646 | { |
628 | if (rw == READ) | 647 | if (sync) |
629 | queue_flag_set(QUEUE_FLAG_READFULL, q); | 648 | queue_flag_set(QUEUE_FLAG_SYNCFULL, q); |
630 | else | 649 | else |
631 | queue_flag_set(QUEUE_FLAG_WRITEFULL, q); | 650 | queue_flag_set(QUEUE_FLAG_ASYNCFULL, q); |
632 | } | 651 | } |
633 | 652 | ||
634 | static inline void blk_clear_queue_full(struct request_queue *q, int rw) | 653 | static inline void blk_clear_queue_full(struct request_queue *q, int sync) |
635 | { | 654 | { |
636 | if (rw == READ) | 655 | if (sync) |
637 | queue_flag_clear(QUEUE_FLAG_READFULL, q); | 656 | queue_flag_clear(QUEUE_FLAG_SYNCFULL, q); |
638 | else | 657 | else |
639 | queue_flag_clear(QUEUE_FLAG_WRITEFULL, q); | 658 | queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q); |
640 | } | 659 | } |
641 | 660 | ||
642 | 661 | ||
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 6faa7e549de4..cebfdcd3dbdd 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -114,7 +114,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
114 | * "Define 'is'", Bill Clinton | 114 | * "Define 'is'", Bill Clinton |
115 | * "Define 'if'", Steven Rostedt | 115 | * "Define 'if'", Steven Rostedt |
116 | */ | 116 | */ |
117 | #define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \ | 117 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) |
118 | #define __trace_if(cond) \ | ||
119 | if (__builtin_constant_p((cond)) ? !!(cond) : \ | ||
118 | ({ \ | 120 | ({ \ |
119 | int ______r; \ | 121 | int ______r; \ |
120 | static struct ftrace_branch_data \ | 122 | static struct ftrace_branch_data \ |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index d7d090d21031..8083b6a36a38 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -115,7 +115,7 @@ static inline u64 dma_get_mask(struct device *dev) | |||
115 | { | 115 | { |
116 | if (dev && dev->dma_mask && *dev->dma_mask) | 116 | if (dev && dev->dma_mask && *dev->dma_mask) |
117 | return *dev->dma_mask; | 117 | return *dev->dma_mask; |
118 | return DMA_32BIT_MASK; | 118 | return DMA_BIT_MASK(32); |
119 | } | 119 | } |
120 | 120 | ||
121 | extern u64 dma_get_required_mask(struct device *dev); | 121 | extern u64 dma_get_required_mask(struct device *dev); |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 2f3427468956..e397dc342cda 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -34,6 +34,7 @@ struct dmar_drhd_unit { | |||
34 | u64 reg_base_addr; /* register base address*/ | 34 | u64 reg_base_addr; /* register base address*/ |
35 | struct pci_dev **devices; /* target device array */ | 35 | struct pci_dev **devices; /* target device array */ |
36 | int devices_cnt; /* target device count */ | 36 | int devices_cnt; /* target device count */ |
37 | u16 segment; /* PCI domain */ | ||
37 | u8 ignored:1; /* ignore drhd */ | 38 | u8 ignored:1; /* ignore drhd */ |
38 | u8 include_all:1; | 39 | u8 include_all:1; |
39 | struct intel_iommu *iommu; | 40 | struct intel_iommu *iommu; |
@@ -44,6 +45,14 @@ extern struct list_head dmar_drhd_units; | |||
44 | #define for_each_drhd_unit(drhd) \ | 45 | #define for_each_drhd_unit(drhd) \ |
45 | list_for_each_entry(drhd, &dmar_drhd_units, list) | 46 | list_for_each_entry(drhd, &dmar_drhd_units, list) |
46 | 47 | ||
48 | #define for_each_active_iommu(i, drhd) \ | ||
49 | list_for_each_entry(drhd, &dmar_drhd_units, list) \ | ||
50 | if (i=drhd->iommu, drhd->ignored) {} else | ||
51 | |||
52 | #define for_each_iommu(i, drhd) \ | ||
53 | list_for_each_entry(drhd, &dmar_drhd_units, list) \ | ||
54 | if (i=drhd->iommu, 0) {} else | ||
55 | |||
47 | extern int dmar_table_init(void); | 56 | extern int dmar_table_init(void); |
48 | extern int dmar_dev_scope_init(void); | 57 | extern int dmar_dev_scope_init(void); |
49 | 58 | ||
@@ -100,6 +109,8 @@ struct irte { | |||
100 | #ifdef CONFIG_INTR_REMAP | 109 | #ifdef CONFIG_INTR_REMAP |
101 | extern int intr_remapping_enabled; | 110 | extern int intr_remapping_enabled; |
102 | extern int enable_intr_remapping(int); | 111 | extern int enable_intr_remapping(int); |
112 | extern void disable_intr_remapping(void); | ||
113 | extern int reenable_intr_remapping(int); | ||
103 | 114 | ||
104 | extern int get_irte(int irq, struct irte *entry); | 115 | extern int get_irte(int irq, struct irte *entry); |
105 | extern int modify_irte(int irq, struct irte *irte_modified); | 116 | extern int modify_irte(int irq, struct irte *irte_modified); |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 7a204256b155..c59b769f62b0 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -116,6 +116,7 @@ extern void elv_abort_queue(struct request_queue *); | |||
116 | extern void elv_completed_request(struct request_queue *, struct request *); | 116 | extern void elv_completed_request(struct request_queue *, struct request *); |
117 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); | 117 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); |
118 | extern void elv_put_request(struct request_queue *, struct request *); | 118 | extern void elv_put_request(struct request_queue *, struct request *); |
119 | extern void elv_drain_elevator(struct request_queue *); | ||
119 | 120 | ||
120 | /* | 121 | /* |
121 | * io scheduler registration | 122 | * io scheduler registration |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 09d6c5bbdddd..a2ec74bc4812 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -5,12 +5,14 @@ | |||
5 | #ifndef __LINUX_FDTABLE_H | 5 | #ifndef __LINUX_FDTABLE_H |
6 | #define __LINUX_FDTABLE_H | 6 | #define __LINUX_FDTABLE_H |
7 | 7 | ||
8 | #include <asm/atomic.h> | ||
9 | #include <linux/posix_types.h> | 8 | #include <linux/posix_types.h> |
10 | #include <linux/compiler.h> | 9 | #include <linux/compiler.h> |
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/rcupdate.h> | 11 | #include <linux/rcupdate.h> |
13 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <asm/atomic.h> | ||
14 | 16 | ||
15 | /* | 17 | /* |
16 | * The default fd array needs to be at least BITS_PER_LONG, | 18 | * The default fd array needs to be at least BITS_PER_LONG, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a09e17c8f5fd..562d2855cf30 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -95,8 +95,12 @@ struct inodes_stat_t { | |||
95 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ | 95 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ |
96 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 96 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
97 | #define READ_META (READ | (1 << BIO_RW_META)) | 97 | #define READ_META (READ | (1 << BIO_RW_META)) |
98 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 98 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
99 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 99 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
100 | #define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | ||
101 | #define SWRITE_SYNC_PLUG \ | ||
102 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | ||
103 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | ||
100 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | 104 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) |
101 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | 105 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) |
102 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | 106 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) |
@@ -1695,6 +1699,9 @@ struct file_system_type { | |||
1695 | struct lock_class_key i_alloc_sem_key; | 1699 | struct lock_class_key i_alloc_sem_key; |
1696 | }; | 1700 | }; |
1697 | 1701 | ||
1702 | extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, | ||
1703 | int (*fill_super)(struct super_block *, void *, int), | ||
1704 | struct vfsmount *mnt); | ||
1698 | extern int get_sb_bdev(struct file_system_type *fs_type, | 1705 | extern int get_sb_bdev(struct file_system_type *fs_type, |
1699 | int flags, const char *dev_name, void *data, | 1706 | int flags, const char *dev_name, void *data, |
1700 | int (*fill_super)(struct super_block *, void *, int), | 1707 | int (*fill_super)(struct super_block *, void *, int), |
@@ -2337,19 +2344,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, | |||
2337 | size_t size, loff_t *pos); | 2344 | size_t size, loff_t *pos); |
2338 | int simple_transaction_release(struct inode *inode, struct file *file); | 2345 | int simple_transaction_release(struct inode *inode, struct file *file); |
2339 | 2346 | ||
2340 | static inline void simple_transaction_set(struct file *file, size_t n) | 2347 | void simple_transaction_set(struct file *file, size_t n); |
2341 | { | ||
2342 | struct simple_transaction_argresp *ar = file->private_data; | ||
2343 | |||
2344 | BUG_ON(n > SIMPLE_TRANSACTION_LIMIT); | ||
2345 | |||
2346 | /* | ||
2347 | * The barrier ensures that ar->size will really remain zero until | ||
2348 | * ar->data is ready for reading. | ||
2349 | */ | ||
2350 | smp_mb(); | ||
2351 | ar->size = n; | ||
2352 | } | ||
2353 | 2348 | ||
2354 | /* | 2349 | /* |
2355 | * simple attribute files | 2350 | * simple attribute files |
@@ -2396,27 +2391,6 @@ ssize_t simple_attr_read(struct file *file, char __user *buf, | |||
2396 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | 2391 | ssize_t simple_attr_write(struct file *file, const char __user *buf, |
2397 | size_t len, loff_t *ppos); | 2392 | size_t len, loff_t *ppos); |
2398 | 2393 | ||
2399 | |||
2400 | #ifdef CONFIG_SECURITY | ||
2401 | static inline char *alloc_secdata(void) | ||
2402 | { | ||
2403 | return (char *)get_zeroed_page(GFP_KERNEL); | ||
2404 | } | ||
2405 | |||
2406 | static inline void free_secdata(void *secdata) | ||
2407 | { | ||
2408 | free_page((unsigned long)secdata); | ||
2409 | } | ||
2410 | #else | ||
2411 | static inline char *alloc_secdata(void) | ||
2412 | { | ||
2413 | return (char *)1; | ||
2414 | } | ||
2415 | |||
2416 | static inline void free_secdata(void *secdata) | ||
2417 | { } | ||
2418 | #endif /* CONFIG_SECURITY */ | ||
2419 | |||
2420 | struct ctl_table; | 2394 | struct ctl_table; |
2421 | int proc_nr_files(struct ctl_table *table, int write, struct file *filp, | 2395 | int proc_nr_files(struct ctl_table *table, int write, struct file *filp, |
2422 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2396 | void __user *buffer, size_t *lenp, loff_t *ppos); |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 7ef1caf50269..f2a78b5e8b55 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #define _FSL_DEVICE_H_ | 18 | #define _FSL_DEVICE_H_ |
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/phy.h> | ||
22 | 21 | ||
23 | /* | 22 | /* |
24 | * Some conventions on how we handle peripherals on Freescale chips | 23 | * Some conventions on how we handle peripherals on Freescale chips |
@@ -44,27 +43,6 @@ | |||
44 | * | 43 | * |
45 | */ | 44 | */ |
46 | 45 | ||
47 | struct gianfar_platform_data { | ||
48 | /* device specific information */ | ||
49 | u32 device_flags; | ||
50 | char bus_id[BUS_ID_SIZE]; | ||
51 | phy_interface_t interface; | ||
52 | }; | ||
53 | |||
54 | struct gianfar_mdio_data { | ||
55 | /* board specific information */ | ||
56 | int irq[32]; | ||
57 | }; | ||
58 | |||
59 | /* Flags in gianfar_platform_data */ | ||
60 | #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ | ||
61 | #define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ | ||
62 | |||
63 | struct fsl_i2c_platform_data { | ||
64 | /* device specific information */ | ||
65 | u32 device_flags; | ||
66 | }; | ||
67 | |||
68 | /* Flags related to I2C device features */ | 46 | /* Flags related to I2C device features */ |
69 | #define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 | 47 | #define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 |
70 | #define FSL_I2C_DEV_CLOCK_5200 0x00000002 | 48 | #define FSL_I2C_DEV_CLOCK_5200 0x00000002 |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index bd37078c2d7d..0d2f7c8a33d6 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -336,6 +336,11 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | |||
336 | const enum hrtimer_mode mode); | 336 | const enum hrtimer_mode mode); |
337 | extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, | 337 | extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
338 | unsigned long range_ns, const enum hrtimer_mode mode); | 338 | unsigned long range_ns, const enum hrtimer_mode mode); |
339 | extern int | ||
340 | __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, | ||
341 | unsigned long delta_ns, | ||
342 | const enum hrtimer_mode mode, int wakeup); | ||
343 | |||
339 | extern int hrtimer_cancel(struct hrtimer *timer); | 344 | extern int hrtimer_cancel(struct hrtimer *timer); |
340 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); | 345 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); |
341 | 346 | ||
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h deleted file mode 100644 index 3b7715024e69..000000000000 --- a/include/linux/i2c-algo-sgi.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License version 2 as published by the Free Software Foundation. | ||
4 | * | ||
5 | * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org> | ||
6 | */ | ||
7 | |||
8 | #ifndef I2C_ALGO_SGI_H | ||
9 | #define I2C_ALGO_SGI_H 1 | ||
10 | |||
11 | #include <linux/i2c.h> | ||
12 | |||
13 | struct i2c_algo_sgi_data { | ||
14 | void *data; /* private data for lowlevel routines */ | ||
15 | unsigned (*getctrl)(void *data); | ||
16 | void (*setctrl)(void *data, unsigned val); | ||
17 | unsigned (*rdata)(void *data); | ||
18 | void (*wdata)(void *data, unsigned val); | ||
19 | |||
20 | int xfer_timeout; | ||
21 | int ack_timeout; | ||
22 | }; | ||
23 | |||
24 | int i2c_sgi_add_bus(struct i2c_adapter *); | ||
25 | |||
26 | #endif /* I2C_ALGO_SGI_H */ | ||
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index f27604af8378..c9087de5c6c6 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -33,47 +33,10 @@ | |||
33 | 33 | ||
34 | #define I2C_DRIVERID_MSP3400 1 | 34 | #define I2C_DRIVERID_MSP3400 1 |
35 | #define I2C_DRIVERID_TUNER 2 | 35 | #define I2C_DRIVERID_TUNER 2 |
36 | #define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ | ||
37 | #define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ | ||
38 | #define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ | ||
39 | #define I2C_DRIVERID_SAA7111A 8 /* video input processor */ | ||
40 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ | ||
41 | #define I2C_DRIVERID_SAA7110 22 /* video decoder */ | ||
42 | #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ | ||
43 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ | 36 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ |
44 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ | 37 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ |
45 | #define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ | ||
46 | #define I2C_DRIVERID_BT819 40 /* video decoder */ | ||
47 | #define I2C_DRIVERID_BT856 41 /* video encoder */ | ||
48 | #define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ | ||
49 | #define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */ | ||
50 | #define I2C_DRIVERID_SAA7114 49 /* video decoder */ | ||
51 | #define I2C_DRIVERID_ADV7170 54 /* video encoder */ | ||
52 | #define I2C_DRIVERID_SAA7191 57 /* video decoder */ | ||
53 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | ||
54 | #define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ | ||
55 | #define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ | ||
56 | #define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ | ||
57 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ | ||
58 | #define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ | ||
59 | #define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ | ||
60 | #define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */ | ||
61 | #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ | 38 | #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ |
62 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ | 39 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ |
63 | #define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */ | ||
64 | #define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */ | ||
65 | #define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */ | ||
66 | #define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ | ||
67 | #define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ | ||
68 | #define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ | ||
69 | #define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ | ||
70 | #define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ | ||
71 | #define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ | ||
72 | #define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ | ||
73 | #define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ | ||
74 | #define I2C_DRIVERID_AU8522 97 /* Auvitek au8522 */ | ||
75 | |||
76 | #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ | ||
77 | 40 | ||
78 | /* | 41 | /* |
79 | * ---- Adapter types ---------------------------------------------------- | 42 | * ---- Adapter types ---------------------------------------------------- |
@@ -88,6 +51,7 @@ | |||
88 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ | 51 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ |
89 | #define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ | 52 | #define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ |
90 | #define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */ | 53 | #define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */ |
54 | #define I2C_HW_B_CX231XX 0x010024 /* Conexant CX231XX USB based cards */ | ||
91 | #define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */ | 55 | #define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */ |
92 | 56 | ||
93 | /* --- SGI adapters */ | 57 | /* --- SGI adapters */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index c86c3b07604c..00ee11eb9092 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -353,8 +353,8 @@ struct i2c_adapter { | |||
353 | void *algo_data; | 353 | void *algo_data; |
354 | 354 | ||
355 | /* --- administration stuff. */ | 355 | /* --- administration stuff. */ |
356 | int (*client_register)(struct i2c_client *); | 356 | int (*client_register)(struct i2c_client *) __deprecated; |
357 | int (*client_unregister)(struct i2c_client *); | 357 | int (*client_unregister)(struct i2c_client *) __deprecated; |
358 | 358 | ||
359 | /* data fields that are valid for all devices */ | 359 | /* data fields that are valid for all devices */ |
360 | u8 level; /* nesting level for lockdep */ | 360 | u8 level; /* nesting level for lockdep */ |
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h new file mode 100644 index 000000000000..d9b34bfdae76 --- /dev/null +++ b/include/linux/i2c/s6000.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __LINUX_I2C_S6000_H | ||
2 | #define __LINUX_I2C_S6000_H | ||
3 | |||
4 | struct s6_i2c_platform_data { | ||
5 | const char *clock; /* the clock to use */ | ||
6 | int bus_num; /* the bus number to register */ | ||
7 | }; | ||
8 | |||
9 | #endif | ||
10 | |||
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 77214ead1a36..aa8c53171233 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -164,6 +164,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
164 | #define DMA_GCMD_QIE (((u32)1) << 26) | 164 | #define DMA_GCMD_QIE (((u32)1) << 26) |
165 | #define DMA_GCMD_SIRTP (((u32)1) << 24) | 165 | #define DMA_GCMD_SIRTP (((u32)1) << 24) |
166 | #define DMA_GCMD_IRE (((u32) 1) << 25) | 166 | #define DMA_GCMD_IRE (((u32) 1) << 25) |
167 | #define DMA_GCMD_CFI (((u32) 1) << 23) | ||
167 | 168 | ||
168 | /* GSTS_REG */ | 169 | /* GSTS_REG */ |
169 | #define DMA_GSTS_TES (((u32)1) << 31) | 170 | #define DMA_GSTS_TES (((u32)1) << 31) |
@@ -174,6 +175,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
174 | #define DMA_GSTS_QIES (((u32)1) << 26) | 175 | #define DMA_GSTS_QIES (((u32)1) << 26) |
175 | #define DMA_GSTS_IRTPS (((u32)1) << 24) | 176 | #define DMA_GSTS_IRTPS (((u32)1) << 24) |
176 | #define DMA_GSTS_IRES (((u32)1) << 25) | 177 | #define DMA_GSTS_IRES (((u32)1) << 25) |
178 | #define DMA_GSTS_CFIS (((u32)1) << 23) | ||
177 | 179 | ||
178 | /* CCMD_REG */ | 180 | /* CCMD_REG */ |
179 | #define DMA_CCMD_ICC (((u64)1) << 63) | 181 | #define DMA_CCMD_ICC (((u64)1) << 63) |
@@ -284,6 +286,14 @@ struct iommu_flush { | |||
284 | unsigned int size_order, u64 type, int non_present_entry_flush); | 286 | unsigned int size_order, u64 type, int non_present_entry_flush); |
285 | }; | 287 | }; |
286 | 288 | ||
289 | enum { | ||
290 | SR_DMAR_FECTL_REG, | ||
291 | SR_DMAR_FEDATA_REG, | ||
292 | SR_DMAR_FEADDR_REG, | ||
293 | SR_DMAR_FEUADDR_REG, | ||
294 | MAX_SR_DMAR_REGS | ||
295 | }; | ||
296 | |||
287 | struct intel_iommu { | 297 | struct intel_iommu { |
288 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ | 298 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ |
289 | u64 cap; | 299 | u64 cap; |
@@ -304,6 +314,8 @@ struct intel_iommu { | |||
304 | struct iommu_flush flush; | 314 | struct iommu_flush flush; |
305 | #endif | 315 | #endif |
306 | struct q_inval *qi; /* Queued invalidation info */ | 316 | struct q_inval *qi; /* Queued invalidation info */ |
317 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ | ||
318 | |||
307 | #ifdef CONFIG_INTR_REMAP | 319 | #ifdef CONFIG_INTR_REMAP |
308 | struct ir_table *ir_table; /* Interrupt remapping info */ | 320 | struct ir_table *ir_table; /* Interrupt remapping info */ |
309 | #endif | 321 | #endif |
@@ -322,6 +334,7 @@ extern int alloc_iommu(struct dmar_drhd_unit *drhd); | |||
322 | extern void free_iommu(struct intel_iommu *iommu); | 334 | extern void free_iommu(struct intel_iommu *iommu); |
323 | extern int dmar_enable_qi(struct intel_iommu *iommu); | 335 | extern int dmar_enable_qi(struct intel_iommu *iommu); |
324 | extern void dmar_disable_qi(struct intel_iommu *iommu); | 336 | extern void dmar_disable_qi(struct intel_iommu *iommu); |
337 | extern int dmar_reenable_qi(struct intel_iommu *iommu); | ||
325 | extern void qi_global_iec(struct intel_iommu *iommu); | 338 | extern void qi_global_iec(struct intel_iommu *iommu); |
326 | 339 | ||
327 | extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, | 340 | extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 675727fb4b47..91bb76f44f14 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -364,6 +364,7 @@ extern void softirq_init(void); | |||
364 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) | 364 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) |
365 | extern void raise_softirq_irqoff(unsigned int nr); | 365 | extern void raise_softirq_irqoff(unsigned int nr); |
366 | extern void raise_softirq(unsigned int nr); | 366 | extern void raise_softirq(unsigned int nr); |
367 | extern void wakeup_softirqd(void); | ||
367 | 368 | ||
368 | /* This is the worklist that queues up per-cpu softirq work. | 369 | /* This is the worklist that queues up per-cpu softirq work. |
369 | * | 370 | * |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index ea330f9e7100..3bf40e246a80 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -25,7 +25,7 @@ struct ipc_ids { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | struct ipc_namespace { | 27 | struct ipc_namespace { |
28 | struct kref kref; | 28 | atomic_t count; |
29 | struct ipc_ids ids[3]; | 29 | struct ipc_ids ids[3]; |
30 | 30 | ||
31 | int sem_ctls[4]; | 31 | int sem_ctls[4]; |
@@ -44,25 +44,57 @@ struct ipc_namespace { | |||
44 | int shm_tot; | 44 | int shm_tot; |
45 | 45 | ||
46 | struct notifier_block ipcns_nb; | 46 | struct notifier_block ipcns_nb; |
47 | |||
48 | /* The kern_mount of the mqueuefs sb. We take a ref on it */ | ||
49 | struct vfsmount *mq_mnt; | ||
50 | |||
51 | /* # queues in this ns, protected by mq_lock */ | ||
52 | unsigned int mq_queues_count; | ||
53 | |||
54 | /* next fields are set through sysctl */ | ||
55 | unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ | ||
56 | unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ | ||
57 | unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ | ||
58 | |||
47 | }; | 59 | }; |
48 | 60 | ||
49 | extern struct ipc_namespace init_ipc_ns; | 61 | extern struct ipc_namespace init_ipc_ns; |
50 | extern atomic_t nr_ipc_ns; | 62 | extern atomic_t nr_ipc_ns; |
51 | 63 | ||
52 | #ifdef CONFIG_SYSVIPC | 64 | extern spinlock_t mq_lock; |
65 | #if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC) | ||
53 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, | 66 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, |
67 | #else | ||
68 | #define INIT_IPC_NS(ns) | ||
69 | #endif | ||
54 | 70 | ||
71 | #ifdef CONFIG_SYSVIPC | ||
55 | extern int register_ipcns_notifier(struct ipc_namespace *); | 72 | extern int register_ipcns_notifier(struct ipc_namespace *); |
56 | extern int cond_register_ipcns_notifier(struct ipc_namespace *); | 73 | extern int cond_register_ipcns_notifier(struct ipc_namespace *); |
57 | extern void unregister_ipcns_notifier(struct ipc_namespace *); | 74 | extern void unregister_ipcns_notifier(struct ipc_namespace *); |
58 | extern int ipcns_notify(unsigned long); | 75 | extern int ipcns_notify(unsigned long); |
59 | |||
60 | #else /* CONFIG_SYSVIPC */ | 76 | #else /* CONFIG_SYSVIPC */ |
61 | #define INIT_IPC_NS(ns) | 77 | static inline int register_ipcns_notifier(struct ipc_namespace *ns) |
78 | { return 0; } | ||
79 | static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns) | ||
80 | { return 0; } | ||
81 | static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { } | ||
82 | static inline int ipcns_notify(unsigned long l) { return 0; } | ||
62 | #endif /* CONFIG_SYSVIPC */ | 83 | #endif /* CONFIG_SYSVIPC */ |
63 | 84 | ||
64 | #if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) | 85 | #ifdef CONFIG_POSIX_MQUEUE |
65 | extern void free_ipc_ns(struct kref *kref); | 86 | extern int mq_init_ns(struct ipc_namespace *ns); |
87 | /* default values */ | ||
88 | #define DFLT_QUEUESMAX 256 /* max number of message queues */ | ||
89 | #define DFLT_MSGMAX 10 /* max number of messages in each queue */ | ||
90 | #define HARD_MSGMAX (131072/sizeof(void *)) | ||
91 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ | ||
92 | #else | ||
93 | static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } | ||
94 | #endif | ||
95 | |||
96 | #if defined(CONFIG_IPC_NS) | ||
97 | extern void free_ipc_ns(struct ipc_namespace *ns); | ||
66 | extern struct ipc_namespace *copy_ipcs(unsigned long flags, | 98 | extern struct ipc_namespace *copy_ipcs(unsigned long flags, |
67 | struct ipc_namespace *ns); | 99 | struct ipc_namespace *ns); |
68 | extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, | 100 | extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, |
@@ -72,14 +104,11 @@ extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, | |||
72 | static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) | 104 | static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) |
73 | { | 105 | { |
74 | if (ns) | 106 | if (ns) |
75 | kref_get(&ns->kref); | 107 | atomic_inc(&ns->count); |
76 | return ns; | 108 | return ns; |
77 | } | 109 | } |
78 | 110 | ||
79 | static inline void put_ipc_ns(struct ipc_namespace *ns) | 111 | extern void put_ipc_ns(struct ipc_namespace *ns); |
80 | { | ||
81 | kref_put(&ns->kref, free_ipc_ns); | ||
82 | } | ||
83 | #else | 112 | #else |
84 | static inline struct ipc_namespace *copy_ipcs(unsigned long flags, | 113 | static inline struct ipc_namespace *copy_ipcs(unsigned long flags, |
85 | struct ipc_namespace *ns) | 114 | struct ipc_namespace *ns) |
@@ -99,4 +128,18 @@ static inline void put_ipc_ns(struct ipc_namespace *ns) | |||
99 | { | 128 | { |
100 | } | 129 | } |
101 | #endif | 130 | #endif |
131 | |||
132 | #ifdef CONFIG_POSIX_MQUEUE_SYSCTL | ||
133 | |||
134 | struct ctl_table_header; | ||
135 | extern struct ctl_table_header *mq_register_sysctl_table(void); | ||
136 | |||
137 | #else /* CONFIG_POSIX_MQUEUE_SYSCTL */ | ||
138 | |||
139 | static inline struct ctl_table_header *mq_register_sysctl_table(void) | ||
140 | { | ||
141 | return NULL; | ||
142 | } | ||
143 | |||
144 | #endif /* CONFIG_POSIX_MQUEUE_SYSCTL */ | ||
102 | #endif | 145 | #endif |
diff --git a/include/linux/key.h b/include/linux/key.h index 21d32a142c00..e544f466d69a 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/rbtree.h> | 20 | #include <linux/rbtree.h> |
21 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
22 | #include <linux/sysctl.h> | 22 | #include <linux/sysctl.h> |
23 | #include <linux/rwsem.h> | ||
23 | #include <asm/atomic.h> | 24 | #include <asm/atomic.h> |
24 | 25 | ||
25 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 2ec6cc14a114..bcd9c07848be 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -94,12 +94,16 @@ struct kprobe { | |||
94 | /* Called after addr is executed, unless... */ | 94 | /* Called after addr is executed, unless... */ |
95 | kprobe_post_handler_t post_handler; | 95 | kprobe_post_handler_t post_handler; |
96 | 96 | ||
97 | /* ... called if executing addr causes a fault (eg. page fault). | 97 | /* |
98 | * Return 1 if it handled fault, otherwise kernel will see it. */ | 98 | * ... called if executing addr causes a fault (eg. page fault). |
99 | * Return 1 if it handled fault, otherwise kernel will see it. | ||
100 | */ | ||
99 | kprobe_fault_handler_t fault_handler; | 101 | kprobe_fault_handler_t fault_handler; |
100 | 102 | ||
101 | /* ... called if breakpoint trap occurs in probe handler. | 103 | /* |
102 | * Return 1 if it handled break, otherwise kernel will see it. */ | 104 | * ... called if breakpoint trap occurs in probe handler. |
105 | * Return 1 if it handled break, otherwise kernel will see it. | ||
106 | */ | ||
103 | kprobe_break_handler_t break_handler; | 107 | kprobe_break_handler_t break_handler; |
104 | 108 | ||
105 | /* Saved opcode (which has been replaced with breakpoint) */ | 109 | /* Saved opcode (which has been replaced with breakpoint) */ |
@@ -108,18 +112,28 @@ struct kprobe { | |||
108 | /* copy of the original instruction */ | 112 | /* copy of the original instruction */ |
109 | struct arch_specific_insn ainsn; | 113 | struct arch_specific_insn ainsn; |
110 | 114 | ||
111 | /* Indicates various status flags. Protected by kprobe_mutex. */ | 115 | /* |
116 | * Indicates various status flags. | ||
117 | * Protected by kprobe_mutex after this kprobe is registered. | ||
118 | */ | ||
112 | u32 flags; | 119 | u32 flags; |
113 | }; | 120 | }; |
114 | 121 | ||
115 | /* Kprobe status flags */ | 122 | /* Kprobe status flags */ |
116 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ | 123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ |
124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ | ||
117 | 125 | ||
126 | /* Has this kprobe gone ? */ | ||
118 | static inline int kprobe_gone(struct kprobe *p) | 127 | static inline int kprobe_gone(struct kprobe *p) |
119 | { | 128 | { |
120 | return p->flags & KPROBE_FLAG_GONE; | 129 | return p->flags & KPROBE_FLAG_GONE; |
121 | } | 130 | } |
122 | 131 | ||
132 | /* Is this kprobe disabled ? */ | ||
133 | static inline int kprobe_disabled(struct kprobe *p) | ||
134 | { | ||
135 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); | ||
136 | } | ||
123 | /* | 137 | /* |
124 | * Special probe type that uses setjmp-longjmp type tricks to resume | 138 | * Special probe type that uses setjmp-longjmp type tricks to resume |
125 | * execution at a specified entry with a matching prototype corresponding | 139 | * execution at a specified entry with a matching prototype corresponding |
@@ -279,6 +293,9 @@ void unregister_kretprobes(struct kretprobe **rps, int num); | |||
279 | void kprobe_flush_task(struct task_struct *tk); | 293 | void kprobe_flush_task(struct task_struct *tk); |
280 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 294 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); |
281 | 295 | ||
296 | int disable_kprobe(struct kprobe *kp); | ||
297 | int enable_kprobe(struct kprobe *kp); | ||
298 | |||
282 | #else /* !CONFIG_KPROBES: */ | 299 | #else /* !CONFIG_KPROBES: */ |
283 | 300 | ||
284 | static inline int kprobes_built_in(void) | 301 | static inline int kprobes_built_in(void) |
@@ -345,5 +362,30 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num) | |||
345 | static inline void kprobe_flush_task(struct task_struct *tk) | 362 | static inline void kprobe_flush_task(struct task_struct *tk) |
346 | { | 363 | { |
347 | } | 364 | } |
365 | static inline int disable_kprobe(struct kprobe *kp) | ||
366 | { | ||
367 | return -ENOSYS; | ||
368 | } | ||
369 | static inline int enable_kprobe(struct kprobe *kp) | ||
370 | { | ||
371 | return -ENOSYS; | ||
372 | } | ||
348 | #endif /* CONFIG_KPROBES */ | 373 | #endif /* CONFIG_KPROBES */ |
374 | static inline int disable_kretprobe(struct kretprobe *rp) | ||
375 | { | ||
376 | return disable_kprobe(&rp->kp); | ||
377 | } | ||
378 | static inline int enable_kretprobe(struct kretprobe *rp) | ||
379 | { | ||
380 | return enable_kprobe(&rp->kp); | ||
381 | } | ||
382 | static inline int disable_jprobe(struct jprobe *jp) | ||
383 | { | ||
384 | return disable_kprobe(&jp->kp); | ||
385 | } | ||
386 | static inline int enable_jprobe(struct jprobe *jp) | ||
387 | { | ||
388 | return enable_kprobe(&jp->kp); | ||
389 | } | ||
390 | |||
349 | #endif /* _LINUX_KPROBES_H */ | 391 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/leds-bd2802.h b/include/linux/leds-bd2802.h new file mode 100644 index 000000000000..42f854a1a199 --- /dev/null +++ b/include/linux/leds-bd2802.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * leds-bd2802.h - RGB LED Driver | ||
3 | * | ||
4 | * Copyright (C) 2009 Samsung Electronics | ||
5 | * Kim Kyuwon <q1.kim@samsung.com> | ||
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 version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * Datasheet: http://www.rohm.com/products/databook/driver/pdf/bd2802gu-e.pdf | ||
12 | * | ||
13 | */ | ||
14 | #ifndef _LEDS_BD2802_H_ | ||
15 | #define _LEDS_BD2802_H_ | ||
16 | |||
17 | struct bd2802_led_platform_data{ | ||
18 | int reset_gpio; | ||
19 | u8 rgb_time; | ||
20 | }; | ||
21 | |||
22 | #define RGB_TIME(slopedown, slopeup, waveform) \ | ||
23 | ((slopedown) << 6 | (slopeup) << 4 | (waveform)) | ||
24 | |||
25 | #endif /* _LEDS_BD2802_H_ */ | ||
26 | |||
diff --git a/include/linux/leds.h b/include/linux/leds.h index 24489da701e3..376fe07732ea 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -30,6 +30,7 @@ enum led_brightness { | |||
30 | struct led_classdev { | 30 | struct led_classdev { |
31 | const char *name; | 31 | const char *name; |
32 | int brightness; | 32 | int brightness; |
33 | int max_brightness; | ||
33 | int flags; | 34 | int flags; |
34 | 35 | ||
35 | /* Lower 16 bits reflect status */ | 36 | /* Lower 16 bits reflect status */ |
@@ -140,7 +141,8 @@ struct gpio_led { | |||
140 | const char *name; | 141 | const char *name; |
141 | const char *default_trigger; | 142 | const char *default_trigger; |
142 | unsigned gpio; | 143 | unsigned gpio; |
143 | u8 active_low; | 144 | u8 active_low : 1; |
145 | u8 retain_state_suspended : 1; | ||
144 | }; | 146 | }; |
145 | 147 | ||
146 | struct gpio_led_platform_data { | 148 | struct gpio_led_platform_data { |
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h new file mode 100644 index 000000000000..33a071167489 --- /dev/null +++ b/include/linux/leds_pwm.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * PWM LED driver data - see drivers/leds/leds-pwm.c | ||
3 | */ | ||
4 | #ifndef __LINUX_LEDS_PWM_H | ||
5 | #define __LINUX_LEDS_PWM_H | ||
6 | |||
7 | struct led_pwm { | ||
8 | const char *name; | ||
9 | const char *default_trigger; | ||
10 | unsigned pwm_id; | ||
11 | u8 active_low; | ||
12 | unsigned max_brightness; | ||
13 | unsigned pwm_period_ns; | ||
14 | }; | ||
15 | |||
16 | struct led_pwm_platform_data { | ||
17 | int num_leds; | ||
18 | struct led_pwm *leds; | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 7dc5b6cb44cd..d39ed1cc5fbf 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -25,13 +25,13 @@ struct svc_rqst; | |||
25 | #define NLM_MAXCOOKIELEN 32 | 25 | #define NLM_MAXCOOKIELEN 32 |
26 | #define NLM_MAXSTRLEN 1024 | 26 | #define NLM_MAXSTRLEN 1024 |
27 | 27 | ||
28 | #define nlm_granted __constant_htonl(NLM_LCK_GRANTED) | 28 | #define nlm_granted cpu_to_be32(NLM_LCK_GRANTED) |
29 | #define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) | 29 | #define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED) |
30 | #define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) | 30 | #define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS) |
31 | #define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) | 31 | #define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED) |
32 | #define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) | 32 | #define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD) |
33 | 33 | ||
34 | #define nlm_drop_reply __constant_htonl(30000) | 34 | #define nlm_drop_reply cpu_to_be32(30000) |
35 | 35 | ||
36 | /* Lock info passed via NLM */ | 36 | /* Lock info passed via NLM */ |
37 | struct nlm_lock { | 37 | struct nlm_lock { |
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h index 12bfe09de2b1..7353821341ed 100644 --- a/include/linux/lockd/xdr4.h +++ b/include/linux/lockd/xdr4.h | |||
@@ -15,11 +15,11 @@ | |||
15 | #include <linux/lockd/xdr.h> | 15 | #include <linux/lockd/xdr.h> |
16 | 16 | ||
17 | /* error codes new to NLMv4 */ | 17 | /* error codes new to NLMv4 */ |
18 | #define nlm4_deadlock __constant_htonl(NLM_DEADLCK) | 18 | #define nlm4_deadlock cpu_to_be32(NLM_DEADLCK) |
19 | #define nlm4_rofs __constant_htonl(NLM_ROFS) | 19 | #define nlm4_rofs cpu_to_be32(NLM_ROFS) |
20 | #define nlm4_stale_fh __constant_htonl(NLM_STALE_FH) | 20 | #define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH) |
21 | #define nlm4_fbig __constant_htonl(NLM_FBIG) | 21 | #define nlm4_fbig cpu_to_be32(NLM_FBIG) |
22 | #define nlm4_failed __constant_htonl(NLM_FAILED) | 22 | #define nlm4_failed cpu_to_be32(NLM_FAILED) |
23 | 23 | ||
24 | 24 | ||
25 | 25 | ||
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h new file mode 100644 index 000000000000..1f76b1ebf627 --- /dev/null +++ b/include/linux/mg_disk.h | |||
@@ -0,0 +1,206 @@ | |||
1 | /* | ||
2 | * include/linux/mg_disk.c | ||
3 | * | ||
4 | * Support for the mGine m[g]flash IO mode. | ||
5 | * Based on legacy hd.c | ||
6 | * | ||
7 | * (c) 2008 mGine Co.,LTD | ||
8 | * (c) 2008 unsik Kim <donari75@gmail.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef __MG_DISK_H__ | ||
16 | #define __MG_DISK_H__ | ||
17 | |||
18 | #include <linux/blkdev.h> | ||
19 | #include <linux/ata.h> | ||
20 | |||
21 | /* name for block device */ | ||
22 | #define MG_DISK_NAME "mgd" | ||
23 | /* name for platform device */ | ||
24 | #define MG_DEV_NAME "mg_disk" | ||
25 | |||
26 | #define MG_DISK_MAJ 0 | ||
27 | #define MG_DISK_MAX_PART 16 | ||
28 | #define MG_SECTOR_SIZE 512 | ||
29 | #define MG_MAX_SECTS 256 | ||
30 | |||
31 | /* Register offsets */ | ||
32 | #define MG_BUFF_OFFSET 0x8000 | ||
33 | #define MG_STORAGE_BUFFER_SIZE 0x200 | ||
34 | #define MG_REG_OFFSET 0xC000 | ||
35 | #define MG_REG_FEATURE (MG_REG_OFFSET + 2) /* write case */ | ||
36 | #define MG_REG_ERROR (MG_REG_OFFSET + 2) /* read case */ | ||
37 | #define MG_REG_SECT_CNT (MG_REG_OFFSET + 4) | ||
38 | #define MG_REG_SECT_NUM (MG_REG_OFFSET + 6) | ||
39 | #define MG_REG_CYL_LOW (MG_REG_OFFSET + 8) | ||
40 | #define MG_REG_CYL_HIGH (MG_REG_OFFSET + 0xA) | ||
41 | #define MG_REG_DRV_HEAD (MG_REG_OFFSET + 0xC) | ||
42 | #define MG_REG_COMMAND (MG_REG_OFFSET + 0xE) /* write case */ | ||
43 | #define MG_REG_STATUS (MG_REG_OFFSET + 0xE) /* read case */ | ||
44 | #define MG_REG_DRV_CTRL (MG_REG_OFFSET + 0x10) | ||
45 | #define MG_REG_BURST_CTRL (MG_REG_OFFSET + 0x12) | ||
46 | |||
47 | /* "Drive Select/Head Register" bit values */ | ||
48 | #define MG_REG_HEAD_MUST_BE_ON 0xA0 /* These 2 bits are always on */ | ||
49 | #define MG_REG_HEAD_DRIVE_MASTER (0x00 | MG_REG_HEAD_MUST_BE_ON) | ||
50 | #define MG_REG_HEAD_DRIVE_SLAVE (0x10 | MG_REG_HEAD_MUST_BE_ON) | ||
51 | #define MG_REG_HEAD_LBA_MODE (0x40 | MG_REG_HEAD_MUST_BE_ON) | ||
52 | |||
53 | |||
54 | /* "Device Control Register" bit values */ | ||
55 | #define MG_REG_CTRL_INTR_ENABLE 0x0 | ||
56 | #define MG_REG_CTRL_INTR_DISABLE (0x1<<1) | ||
57 | #define MG_REG_CTRL_RESET (0x1<<2) | ||
58 | #define MG_REG_CTRL_INTR_POLA_ACTIVE_HIGH 0x0 | ||
59 | #define MG_REG_CTRL_INTR_POLA_ACTIVE_LOW (0x1<<4) | ||
60 | #define MG_REG_CTRL_DPD_POLA_ACTIVE_LOW 0x0 | ||
61 | #define MG_REG_CTRL_DPD_POLA_ACTIVE_HIGH (0x1<<5) | ||
62 | #define MG_REG_CTRL_DPD_DISABLE 0x0 | ||
63 | #define MG_REG_CTRL_DPD_ENABLE (0x1<<6) | ||
64 | |||
65 | /* Status register bit */ | ||
66 | /* error bit in status register */ | ||
67 | #define MG_REG_STATUS_BIT_ERROR 0x01 | ||
68 | /* corrected error in status register */ | ||
69 | #define MG_REG_STATUS_BIT_CORRECTED_ERROR 0x04 | ||
70 | /* data request bit in status register */ | ||
71 | #define MG_REG_STATUS_BIT_DATA_REQ 0x08 | ||
72 | /* DSC - Drive Seek Complete */ | ||
73 | #define MG_REG_STATUS_BIT_SEEK_DONE 0x10 | ||
74 | /* DWF - Drive Write Fault */ | ||
75 | #define MG_REG_STATUS_BIT_WRITE_FAULT 0x20 | ||
76 | #define MG_REG_STATUS_BIT_READY 0x40 | ||
77 | #define MG_REG_STATUS_BIT_BUSY 0x80 | ||
78 | |||
79 | /* handy status */ | ||
80 | #define MG_STAT_READY (MG_REG_STATUS_BIT_READY | MG_REG_STATUS_BIT_SEEK_DONE) | ||
81 | #define MG_READY_OK(s) (((s) & (MG_STAT_READY | \ | ||
82 | (MG_REG_STATUS_BIT_BUSY | \ | ||
83 | MG_REG_STATUS_BIT_WRITE_FAULT | \ | ||
84 | MG_REG_STATUS_BIT_ERROR))) == MG_STAT_READY) | ||
85 | |||
86 | /* Error register */ | ||
87 | #define MG_REG_ERR_AMNF 0x01 | ||
88 | #define MG_REG_ERR_ABRT 0x04 | ||
89 | #define MG_REG_ERR_IDNF 0x10 | ||
90 | #define MG_REG_ERR_UNC 0x40 | ||
91 | #define MG_REG_ERR_BBK 0x80 | ||
92 | |||
93 | /* error code for others */ | ||
94 | #define MG_ERR_NONE 0 | ||
95 | #define MG_ERR_TIMEOUT 0x100 | ||
96 | #define MG_ERR_INIT_STAT 0x101 | ||
97 | #define MG_ERR_TRANSLATION 0x102 | ||
98 | #define MG_ERR_CTRL_RST 0x103 | ||
99 | #define MG_ERR_INV_STAT 0x104 | ||
100 | #define MG_ERR_RSTOUT 0x105 | ||
101 | |||
102 | #define MG_MAX_ERRORS 6 /* Max read/write errors */ | ||
103 | |||
104 | /* command */ | ||
105 | #define MG_CMD_RD 0x20 | ||
106 | #define MG_CMD_WR 0x30 | ||
107 | #define MG_CMD_SLEEP 0x99 | ||
108 | #define MG_CMD_WAKEUP 0xC3 | ||
109 | #define MG_CMD_ID 0xEC | ||
110 | #define MG_CMD_WR_CONF 0x3C | ||
111 | #define MG_CMD_RD_CONF 0x40 | ||
112 | |||
113 | /* operation mode */ | ||
114 | #define MG_OP_CASCADE (1 << 0) | ||
115 | #define MG_OP_CASCADE_SYNC_RD (1 << 1) | ||
116 | #define MG_OP_CASCADE_SYNC_WR (1 << 2) | ||
117 | #define MG_OP_INTERLEAVE (1 << 3) | ||
118 | |||
119 | /* synchronous */ | ||
120 | #define MG_BURST_LAT_4 (3 << 4) | ||
121 | #define MG_BURST_LAT_5 (4 << 4) | ||
122 | #define MG_BURST_LAT_6 (5 << 4) | ||
123 | #define MG_BURST_LAT_7 (6 << 4) | ||
124 | #define MG_BURST_LAT_8 (7 << 4) | ||
125 | #define MG_BURST_LEN_4 (1 << 1) | ||
126 | #define MG_BURST_LEN_8 (2 << 1) | ||
127 | #define MG_BURST_LEN_16 (3 << 1) | ||
128 | #define MG_BURST_LEN_32 (4 << 1) | ||
129 | #define MG_BURST_LEN_CONT (0 << 1) | ||
130 | |||
131 | /* timeout value (unit: ms) */ | ||
132 | #define MG_TMAX_CONF_TO_CMD 1 | ||
133 | #define MG_TMAX_WAIT_RD_DRQ 10 | ||
134 | #define MG_TMAX_WAIT_WR_DRQ 500 | ||
135 | #define MG_TMAX_RST_TO_BUSY 10 | ||
136 | #define MG_TMAX_HDRST_TO_RDY 500 | ||
137 | #define MG_TMAX_SWRST_TO_RDY 500 | ||
138 | #define MG_TMAX_RSTOUT 3000 | ||
139 | |||
140 | /* device attribution */ | ||
141 | /* use mflash as boot device */ | ||
142 | #define MG_BOOT_DEV (1 << 0) | ||
143 | /* use mflash as storage device */ | ||
144 | #define MG_STORAGE_DEV (1 << 1) | ||
145 | /* same as MG_STORAGE_DEV, but bootloader already done reset sequence */ | ||
146 | #define MG_STORAGE_DEV_SKIP_RST (1 << 2) | ||
147 | |||
148 | #define MG_DEV_MASK (MG_BOOT_DEV | MG_STORAGE_DEV | MG_STORAGE_DEV_SKIP_RST) | ||
149 | |||
150 | /* names of GPIO resource */ | ||
151 | #define MG_RST_PIN "mg_rst" | ||
152 | /* except MG_BOOT_DEV, reset-out pin should be assigned */ | ||
153 | #define MG_RSTOUT_PIN "mg_rstout" | ||
154 | |||
155 | /* private driver data */ | ||
156 | struct mg_drv_data { | ||
157 | /* disk resource */ | ||
158 | u32 use_polling; | ||
159 | |||
160 | /* device attribution */ | ||
161 | u32 dev_attr; | ||
162 | |||
163 | /* internally used */ | ||
164 | struct mg_host *host; | ||
165 | }; | ||
166 | |||
167 | /* main structure for mflash driver */ | ||
168 | struct mg_host { | ||
169 | struct device *dev; | ||
170 | |||
171 | struct request_queue *breq; | ||
172 | spinlock_t lock; | ||
173 | struct gendisk *gd; | ||
174 | |||
175 | struct timer_list timer; | ||
176 | void (*mg_do_intr) (struct mg_host *); | ||
177 | |||
178 | u16 id[ATA_ID_WORDS]; | ||
179 | |||
180 | u16 cyls; | ||
181 | u16 heads; | ||
182 | u16 sectors; | ||
183 | u32 n_sectors; | ||
184 | u32 nres_sectors; | ||
185 | |||
186 | void __iomem *dev_base; | ||
187 | unsigned int irq; | ||
188 | unsigned int rst; | ||
189 | unsigned int rstout; | ||
190 | |||
191 | u32 major; | ||
192 | u32 error; | ||
193 | }; | ||
194 | |||
195 | /* | ||
196 | * Debugging macro and defines | ||
197 | */ | ||
198 | #undef DO_MG_DEBUG | ||
199 | #ifdef DO_MG_DEBUG | ||
200 | # define MG_DBG(fmt, args...) \ | ||
201 | printk(KERN_DEBUG "%s:%d "fmt, __func__, __LINE__, ##args) | ||
202 | #else /* CONFIG_MG_DEBUG */ | ||
203 | # define MG_DBG(fmt, args...) do { } while (0) | ||
204 | #endif /* CONFIG_MG_DEBUG */ | ||
205 | |||
206 | #endif | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 3aa5d77c2cdb..5675b63a0631 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/uio.h> | 12 | #include <linux/uio.h> |
13 | #include <linux/notifier.h> | 13 | #include <linux/notifier.h> |
14 | #include <linux/device.h> | ||
14 | 15 | ||
15 | #include <linux/mtd/compatmac.h> | 16 | #include <linux/mtd/compatmac.h> |
16 | #include <mtd/mtd-abi.h> | 17 | #include <mtd/mtd-abi.h> |
@@ -162,6 +163,20 @@ struct mtd_info { | |||
162 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 163 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
163 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 164 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
164 | 165 | ||
166 | /* Allow NOMMU mmap() to directly map the device (if not NULL) | ||
167 | * - return the address to which the offset maps | ||
168 | * - return -ENOSYS to indicate refusal to do the mapping | ||
169 | */ | ||
170 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, | ||
171 | unsigned long len, | ||
172 | unsigned long offset, | ||
173 | unsigned long flags); | ||
174 | |||
175 | /* Backing device capabilities for this device | ||
176 | * - provides mmap capabilities | ||
177 | */ | ||
178 | struct backing_dev_info *backing_dev_info; | ||
179 | |||
165 | 180 | ||
166 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 181 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
167 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | 182 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); |
@@ -223,6 +238,7 @@ struct mtd_info { | |||
223 | void *priv; | 238 | void *priv; |
224 | 239 | ||
225 | struct module *owner; | 240 | struct module *owner; |
241 | struct device dev; | ||
226 | int usecount; | 242 | int usecount; |
227 | 243 | ||
228 | /* If the driver is something smart, like UBI, it may need to maintain | 244 | /* If the driver is something smart, like UBI, it may need to maintain |
@@ -233,6 +249,11 @@ struct mtd_info { | |||
233 | void (*put_device) (struct mtd_info *mtd); | 249 | void (*put_device) (struct mtd_info *mtd); |
234 | }; | 250 | }; |
235 | 251 | ||
252 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | ||
253 | { | ||
254 | return dev ? container_of(dev, struct mtd_info, dev) : NULL; | ||
255 | } | ||
256 | |||
236 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 257 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
237 | { | 258 | { |
238 | if (mtd->erasesize_shift) | 259 | if (mtd->erasesize_shift) |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index db5b63da2a7e..7efb9be34662 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -43,8 +43,8 @@ extern void nand_wait_ready(struct mtd_info *mtd); | |||
43 | * is supported now. If you add a chip with bigger oobsize/page | 43 | * is supported now. If you add a chip with bigger oobsize/page |
44 | * adjust this accordingly. | 44 | * adjust this accordingly. |
45 | */ | 45 | */ |
46 | #define NAND_MAX_OOBSIZE 64 | 46 | #define NAND_MAX_OOBSIZE 128 |
47 | #define NAND_MAX_PAGESIZE 2048 | 47 | #define NAND_MAX_PAGESIZE 4096 |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Constants for hardware specific CLE/ALE/NCE function | 50 | * Constants for hardware specific CLE/ALE/NCE function |
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index a45dd831b3f8..7535a74083b9 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -76,4 +76,16 @@ int __devinit of_mtd_parse_partitions(struct device *dev, | |||
76 | struct device_node *node, | 76 | struct device_node *node, |
77 | struct mtd_partition **pparts); | 77 | struct mtd_partition **pparts); |
78 | 78 | ||
79 | #ifdef CONFIG_MTD_PARTITIONS | ||
80 | static inline int mtd_has_partitions(void) { return 1; } | ||
81 | #else | ||
82 | static inline int mtd_has_partitions(void) { return 0; } | ||
83 | #endif | ||
84 | |||
85 | #ifdef CONFIG_MTD_CMDLINE_PARTS | ||
86 | static inline int mtd_has_cmdlinepart(void) { return 1; } | ||
87 | #else | ||
88 | static inline int mtd_has_cmdlinepart(void) { return 0; } | ||
89 | #endif | ||
90 | |||
79 | #endif | 91 | #endif |
diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 54af92c1c70b..214d499718f7 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h | |||
@@ -109,7 +109,6 @@ | |||
109 | NFSERR_FILE_OPEN = 10046, /* v4 */ | 109 | NFSERR_FILE_OPEN = 10046, /* v4 */ |
110 | NFSERR_ADMIN_REVOKED = 10047, /* v4 */ | 110 | NFSERR_ADMIN_REVOKED = 10047, /* v4 */ |
111 | NFSERR_CB_PATH_DOWN = 10048, /* v4 */ | 111 | NFSERR_CB_PATH_DOWN = 10048, /* v4 */ |
112 | NFSERR_REPLAY_ME = 10049 /* v4 */ | ||
113 | }; | 112 | }; |
114 | 113 | ||
115 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ | 114 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index b912311a56b1..e3f0cbcbd0db 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define NFS4_FHSIZE 128 | 21 | #define NFS4_FHSIZE 128 |
22 | #define NFS4_MAXPATHLEN PATH_MAX | 22 | #define NFS4_MAXPATHLEN PATH_MAX |
23 | #define NFS4_MAXNAMLEN NAME_MAX | 23 | #define NFS4_MAXNAMLEN NAME_MAX |
24 | #define NFS4_MAX_SESSIONID_LEN 16 | ||
24 | 25 | ||
25 | #define NFS4_ACCESS_READ 0x0001 | 26 | #define NFS4_ACCESS_READ 0x0001 |
26 | #define NFS4_ACCESS_LOOKUP 0x0002 | 27 | #define NFS4_ACCESS_LOOKUP 0x0002 |
@@ -38,6 +39,7 @@ | |||
38 | #define NFS4_OPEN_RESULT_CONFIRM 0x0002 | 39 | #define NFS4_OPEN_RESULT_CONFIRM 0x0002 |
39 | #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 | 40 | #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 |
40 | 41 | ||
42 | #define NFS4_SHARE_ACCESS_MASK 0x000F | ||
41 | #define NFS4_SHARE_ACCESS_READ 0x0001 | 43 | #define NFS4_SHARE_ACCESS_READ 0x0001 |
42 | #define NFS4_SHARE_ACCESS_WRITE 0x0002 | 44 | #define NFS4_SHARE_ACCESS_WRITE 0x0002 |
43 | #define NFS4_SHARE_ACCESS_BOTH 0x0003 | 45 | #define NFS4_SHARE_ACCESS_BOTH 0x0003 |
@@ -45,6 +47,19 @@ | |||
45 | #define NFS4_SHARE_DENY_WRITE 0x0002 | 47 | #define NFS4_SHARE_DENY_WRITE 0x0002 |
46 | #define NFS4_SHARE_DENY_BOTH 0x0003 | 48 | #define NFS4_SHARE_DENY_BOTH 0x0003 |
47 | 49 | ||
50 | /* nfs41 */ | ||
51 | #define NFS4_SHARE_WANT_MASK 0xFF00 | ||
52 | #define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 | ||
53 | #define NFS4_SHARE_WANT_READ_DELEG 0x0100 | ||
54 | #define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 | ||
55 | #define NFS4_SHARE_WANT_ANY_DELEG 0x0300 | ||
56 | #define NFS4_SHARE_WANT_NO_DELEG 0x0400 | ||
57 | #define NFS4_SHARE_WANT_CANCEL 0x0500 | ||
58 | |||
59 | #define NFS4_SHARE_WHEN_MASK 0xF0000 | ||
60 | #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 | ||
61 | #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 | ||
62 | |||
48 | #define NFS4_SET_TO_SERVER_TIME 0 | 63 | #define NFS4_SET_TO_SERVER_TIME 0 |
49 | #define NFS4_SET_TO_CLIENT_TIME 1 | 64 | #define NFS4_SET_TO_CLIENT_TIME 1 |
50 | 65 | ||
@@ -88,6 +103,31 @@ | |||
88 | #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 | 103 | #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 |
89 | #define NFS4_ACE_MASK_ALL 0x001F01FF | 104 | #define NFS4_ACE_MASK_ALL 0x001F01FF |
90 | 105 | ||
106 | #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 | ||
107 | #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 | ||
108 | #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 | ||
109 | #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 | ||
110 | #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 | ||
111 | #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 | ||
112 | #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 | ||
113 | /* | ||
114 | * Since the validity of these bits depends on whether | ||
115 | * they're set in the argument or response, have separate | ||
116 | * invalid flag masks for arg (_A) and resp (_R). | ||
117 | */ | ||
118 | #define EXCHGID4_FLAG_MASK_A 0x40070003 | ||
119 | #define EXCHGID4_FLAG_MASK_R 0x80070003 | ||
120 | |||
121 | #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 | ||
122 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 | ||
123 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 | ||
124 | #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 | ||
125 | #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 | ||
126 | #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 | ||
127 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 | ||
128 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 | ||
129 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 | ||
130 | |||
91 | #define NFS4_MAX_UINT64 (~(u64)0) | 131 | #define NFS4_MAX_UINT64 (~(u64)0) |
92 | 132 | ||
93 | enum nfs4_acl_whotype { | 133 | enum nfs4_acl_whotype { |
@@ -154,6 +194,28 @@ enum nfs_opnum4 { | |||
154 | OP_VERIFY = 37, | 194 | OP_VERIFY = 37, |
155 | OP_WRITE = 38, | 195 | OP_WRITE = 38, |
156 | OP_RELEASE_LOCKOWNER = 39, | 196 | OP_RELEASE_LOCKOWNER = 39, |
197 | |||
198 | /* nfs41 */ | ||
199 | OP_BACKCHANNEL_CTL = 40, | ||
200 | OP_BIND_CONN_TO_SESSION = 41, | ||
201 | OP_EXCHANGE_ID = 42, | ||
202 | OP_CREATE_SESSION = 43, | ||
203 | OP_DESTROY_SESSION = 44, | ||
204 | OP_FREE_STATEID = 45, | ||
205 | OP_GET_DIR_DELEGATION = 46, | ||
206 | OP_GETDEVICEINFO = 47, | ||
207 | OP_GETDEVICELIST = 48, | ||
208 | OP_LAYOUTCOMMIT = 49, | ||
209 | OP_LAYOUTGET = 50, | ||
210 | OP_LAYOUTRETURN = 51, | ||
211 | OP_SECINFO_NO_NAME = 52, | ||
212 | OP_SEQUENCE = 53, | ||
213 | OP_SET_SSV = 54, | ||
214 | OP_TEST_STATEID = 55, | ||
215 | OP_WANT_DELEGATION = 56, | ||
216 | OP_DESTROY_CLIENTID = 57, | ||
217 | OP_RECLAIM_COMPLETE = 58, | ||
218 | |||
157 | OP_ILLEGAL = 10044, | 219 | OP_ILLEGAL = 10044, |
158 | }; | 220 | }; |
159 | 221 | ||
@@ -230,7 +292,48 @@ enum nfsstat4 { | |||
230 | NFS4ERR_DEADLOCK = 10045, | 292 | NFS4ERR_DEADLOCK = 10045, |
231 | NFS4ERR_FILE_OPEN = 10046, | 293 | NFS4ERR_FILE_OPEN = 10046, |
232 | NFS4ERR_ADMIN_REVOKED = 10047, | 294 | NFS4ERR_ADMIN_REVOKED = 10047, |
233 | NFS4ERR_CB_PATH_DOWN = 10048 | 295 | NFS4ERR_CB_PATH_DOWN = 10048, |
296 | |||
297 | /* nfs41 */ | ||
298 | NFS4ERR_BADIOMODE = 10049, | ||
299 | NFS4ERR_BADLAYOUT = 10050, | ||
300 | NFS4ERR_BAD_SESSION_DIGEST = 10051, | ||
301 | NFS4ERR_BADSESSION = 10052, | ||
302 | NFS4ERR_BADSLOT = 10053, | ||
303 | NFS4ERR_COMPLETE_ALREADY = 10054, | ||
304 | NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, | ||
305 | NFS4ERR_DELEG_ALREADY_WANTED = 10056, | ||
306 | NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */ | ||
307 | NFS4ERR_LAYOUTTRYLATER = 10058, | ||
308 | NFS4ERR_LAYOUTUNAVAILABLE = 10059, | ||
309 | NFS4ERR_NOMATCHING_LAYOUT = 10060, | ||
310 | NFS4ERR_RECALLCONFLICT = 10061, | ||
311 | NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, | ||
312 | NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */ | ||
313 | NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */ | ||
314 | NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */ | ||
315 | NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */ | ||
316 | NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */ | ||
317 | NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */ | ||
318 | NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */ | ||
319 | NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */ | ||
320 | NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */ | ||
321 | NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */ | ||
322 | /* Error 10073 is unused. */ | ||
323 | NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */ | ||
324 | NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ | ||
325 | NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */ | ||
326 | NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */ | ||
327 | NFS4ERR_DEADSESSION = 10078, /* persistent session dead */ | ||
328 | NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */ | ||
329 | NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */ | ||
330 | NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */ | ||
331 | NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */ | ||
332 | NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */ | ||
333 | NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */ | ||
334 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ | ||
335 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ | ||
336 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ | ||
234 | }; | 337 | }; |
235 | 338 | ||
236 | /* | 339 | /* |
@@ -265,7 +368,13 @@ enum opentype4 { | |||
265 | enum createmode4 { | 368 | enum createmode4 { |
266 | NFS4_CREATE_UNCHECKED = 0, | 369 | NFS4_CREATE_UNCHECKED = 0, |
267 | NFS4_CREATE_GUARDED = 1, | 370 | NFS4_CREATE_GUARDED = 1, |
268 | NFS4_CREATE_EXCLUSIVE = 2 | 371 | NFS4_CREATE_EXCLUSIVE = 2, |
372 | /* | ||
373 | * New to NFSv4.1. If session is persistent, | ||
374 | * GUARDED4 MUST be used. Otherwise, use | ||
375 | * EXCLUSIVE4_1 instead of EXCLUSIVE4. | ||
376 | */ | ||
377 | NFS4_CREATE_EXCLUSIVE4_1 = 3 | ||
269 | }; | 378 | }; |
270 | 379 | ||
271 | enum limit_by4 { | 380 | enum limit_by4 { |
@@ -301,6 +410,8 @@ enum lock_type4 { | |||
301 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) | 410 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) |
302 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) | 411 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) |
303 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) | 412 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) |
413 | /* Mandatory in NFSv4.1 */ | ||
414 | #define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11) | ||
304 | 415 | ||
305 | /* Recommended Attributes */ | 416 | /* Recommended Attributes */ |
306 | #define FATTR4_WORD0_ACL (1UL << 12) | 417 | #define FATTR4_WORD0_ACL (1UL << 12) |
@@ -391,6 +502,29 @@ enum { | |||
391 | NFSPROC4_CLNT_GETACL, | 502 | NFSPROC4_CLNT_GETACL, |
392 | NFSPROC4_CLNT_SETACL, | 503 | NFSPROC4_CLNT_SETACL, |
393 | NFSPROC4_CLNT_FS_LOCATIONS, | 504 | NFSPROC4_CLNT_FS_LOCATIONS, |
505 | |||
506 | /* nfs41 */ | ||
507 | NFSPROC4_CLNT_EXCHANGE_ID, | ||
508 | NFSPROC4_CLNT_CREATE_SESSION, | ||
509 | NFSPROC4_CLNT_DESTROY_SESSION, | ||
510 | NFSPROC4_CLNT_SEQUENCE, | ||
511 | NFSPROC4_CLNT_GET_LEASE_TIME, | ||
512 | }; | ||
513 | |||
514 | /* nfs41 types */ | ||
515 | struct nfs4_sessionid { | ||
516 | unsigned char data[NFS4_MAX_SESSIONID_LEN]; | ||
517 | }; | ||
518 | |||
519 | /* Create Session Flags */ | ||
520 | #define SESSION4_PERSIST 0x001 | ||
521 | #define SESSION4_BACK_CHAN 0x002 | ||
522 | #define SESSION4_RDMA 0x004 | ||
523 | |||
524 | enum state_protect_how4 { | ||
525 | SP4_NONE = 0, | ||
526 | SP4_MACH_CRED = 1, | ||
527 | SP4_SSV = 2 | ||
394 | }; | 528 | }; |
395 | 529 | ||
396 | #endif | 530 | #endif |
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h index 04b355c801d8..5bccaab81056 100644 --- a/include/linux/nfsd/cache.h +++ b/include/linux/nfsd/cache.h | |||
@@ -76,4 +76,12 @@ void nfsd_reply_cache_shutdown(void); | |||
76 | int nfsd_cache_lookup(struct svc_rqst *, int); | 76 | int nfsd_cache_lookup(struct svc_rqst *, int); |
77 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); | 77 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); |
78 | 78 | ||
79 | #ifdef CONFIG_NFSD_V4 | ||
80 | void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp); | ||
81 | #else /* CONFIG_NFSD_V4 */ | ||
82 | static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp) | ||
83 | { | ||
84 | } | ||
85 | #endif /* CONFIG_NFSD_V4 */ | ||
86 | |||
79 | #endif /* NFSCACHE_H */ | 87 | #endif /* NFSCACHE_H */ |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index e19f45991b2e..2b49d676d0c9 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -23,7 +23,7 @@ | |||
23 | /* | 23 | /* |
24 | * nfsd version | 24 | * nfsd version |
25 | */ | 25 | */ |
26 | #define NFSD_SUPPORTED_MINOR_VERSION 0 | 26 | #define NFSD_SUPPORTED_MINOR_VERSION 1 |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Flags for nfsd_permission | 29 | * Flags for nfsd_permission |
@@ -53,6 +53,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | |||
53 | extern struct svc_program nfsd_program; | 53 | extern struct svc_program nfsd_program; |
54 | extern struct svc_version nfsd_version2, nfsd_version3, | 54 | extern struct svc_version nfsd_version2, nfsd_version3, |
55 | nfsd_version4; | 55 | nfsd_version4; |
56 | extern u32 nfsd_supported_minorversion; | ||
56 | extern struct mutex nfsd_mutex; | 57 | extern struct mutex nfsd_mutex; |
57 | extern struct svc_serv *nfsd_serv; | 58 | extern struct svc_serv *nfsd_serv; |
58 | 59 | ||
@@ -105,7 +106,7 @@ void nfsd_close(struct file *); | |||
105 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | 106 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, |
106 | loff_t, struct kvec *, int, unsigned long *); | 107 | loff_t, struct kvec *, int, unsigned long *); |
107 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | 108 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, |
108 | loff_t, struct kvec *,int, unsigned long, int *); | 109 | loff_t, struct kvec *,int, unsigned long *, int *); |
109 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | 110 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, |
110 | char *, int *); | 111 | char *, int *); |
111 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | 112 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, |
@@ -149,6 +150,7 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | |||
149 | 150 | ||
150 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; | 151 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; |
151 | int nfsd_vers(int vers, enum vers_op change); | 152 | int nfsd_vers(int vers, enum vers_op change); |
153 | int nfsd_minorversion(u32 minorversion, enum vers_op change); | ||
152 | void nfsd_reset_versions(void); | 154 | void nfsd_reset_versions(void); |
153 | int nfsd_create_serv(void); | 155 | int nfsd_create_serv(void); |
154 | 156 | ||
@@ -186,78 +188,119 @@ void nfsd_lockd_shutdown(void); | |||
186 | /* | 188 | /* |
187 | * These macros provide pre-xdr'ed values for faster operation. | 189 | * These macros provide pre-xdr'ed values for faster operation. |
188 | */ | 190 | */ |
189 | #define nfs_ok __constant_htonl(NFS_OK) | 191 | #define nfs_ok cpu_to_be32(NFS_OK) |
190 | #define nfserr_perm __constant_htonl(NFSERR_PERM) | 192 | #define nfserr_perm cpu_to_be32(NFSERR_PERM) |
191 | #define nfserr_noent __constant_htonl(NFSERR_NOENT) | 193 | #define nfserr_noent cpu_to_be32(NFSERR_NOENT) |
192 | #define nfserr_io __constant_htonl(NFSERR_IO) | 194 | #define nfserr_io cpu_to_be32(NFSERR_IO) |
193 | #define nfserr_nxio __constant_htonl(NFSERR_NXIO) | 195 | #define nfserr_nxio cpu_to_be32(NFSERR_NXIO) |
194 | #define nfserr_eagain __constant_htonl(NFSERR_EAGAIN) | 196 | #define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN) |
195 | #define nfserr_acces __constant_htonl(NFSERR_ACCES) | 197 | #define nfserr_acces cpu_to_be32(NFSERR_ACCES) |
196 | #define nfserr_exist __constant_htonl(NFSERR_EXIST) | 198 | #define nfserr_exist cpu_to_be32(NFSERR_EXIST) |
197 | #define nfserr_xdev __constant_htonl(NFSERR_XDEV) | 199 | #define nfserr_xdev cpu_to_be32(NFSERR_XDEV) |
198 | #define nfserr_nodev __constant_htonl(NFSERR_NODEV) | 200 | #define nfserr_nodev cpu_to_be32(NFSERR_NODEV) |
199 | #define nfserr_notdir __constant_htonl(NFSERR_NOTDIR) | 201 | #define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR) |
200 | #define nfserr_isdir __constant_htonl(NFSERR_ISDIR) | 202 | #define nfserr_isdir cpu_to_be32(NFSERR_ISDIR) |
201 | #define nfserr_inval __constant_htonl(NFSERR_INVAL) | 203 | #define nfserr_inval cpu_to_be32(NFSERR_INVAL) |
202 | #define nfserr_fbig __constant_htonl(NFSERR_FBIG) | 204 | #define nfserr_fbig cpu_to_be32(NFSERR_FBIG) |
203 | #define nfserr_nospc __constant_htonl(NFSERR_NOSPC) | 205 | #define nfserr_nospc cpu_to_be32(NFSERR_NOSPC) |
204 | #define nfserr_rofs __constant_htonl(NFSERR_ROFS) | 206 | #define nfserr_rofs cpu_to_be32(NFSERR_ROFS) |
205 | #define nfserr_mlink __constant_htonl(NFSERR_MLINK) | 207 | #define nfserr_mlink cpu_to_be32(NFSERR_MLINK) |
206 | #define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP) | 208 | #define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP) |
207 | #define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG) | 209 | #define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG) |
208 | #define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY) | 210 | #define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY) |
209 | #define nfserr_dquot __constant_htonl(NFSERR_DQUOT) | 211 | #define nfserr_dquot cpu_to_be32(NFSERR_DQUOT) |
210 | #define nfserr_stale __constant_htonl(NFSERR_STALE) | 212 | #define nfserr_stale cpu_to_be32(NFSERR_STALE) |
211 | #define nfserr_remote __constant_htonl(NFSERR_REMOTE) | 213 | #define nfserr_remote cpu_to_be32(NFSERR_REMOTE) |
212 | #define nfserr_wflush __constant_htonl(NFSERR_WFLUSH) | 214 | #define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH) |
213 | #define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE) | 215 | #define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE) |
214 | #define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC) | 216 | #define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC) |
215 | #define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE) | 217 | #define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE) |
216 | #define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP) | 218 | #define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP) |
217 | #define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL) | 219 | #define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL) |
218 | #define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT) | 220 | #define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT) |
219 | #define nfserr_badtype __constant_htonl(NFSERR_BADTYPE) | 221 | #define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE) |
220 | #define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX) | 222 | #define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX) |
221 | #define nfserr_denied __constant_htonl(NFSERR_DENIED) | 223 | #define nfserr_denied cpu_to_be32(NFSERR_DENIED) |
222 | #define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK) | 224 | #define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK) |
223 | #define nfserr_expired __constant_htonl(NFSERR_EXPIRED) | 225 | #define nfserr_expired cpu_to_be32(NFSERR_EXPIRED) |
224 | #define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE) | 226 | #define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE) |
225 | #define nfserr_same __constant_htonl(NFSERR_SAME) | 227 | #define nfserr_same cpu_to_be32(NFSERR_SAME) |
226 | #define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) | 228 | #define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE) |
227 | #define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) | 229 | #define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID) |
228 | #define nfserr_resource __constant_htonl(NFSERR_RESOURCE) | 230 | #define nfserr_resource cpu_to_be32(NFSERR_RESOURCE) |
229 | #define nfserr_moved __constant_htonl(NFSERR_MOVED) | 231 | #define nfserr_moved cpu_to_be32(NFSERR_MOVED) |
230 | #define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) | 232 | #define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE) |
231 | #define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) | 233 | #define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH) |
232 | #define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED) | 234 | #define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED) |
233 | #define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID) | 235 | #define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID) |
234 | #define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID) | 236 | #define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID) |
235 | #define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID) | 237 | #define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID) |
236 | #define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID) | 238 | #define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID) |
237 | #define nfserr_symlink __constant_htonl(NFSERR_SYMLINK) | 239 | #define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK) |
238 | #define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME) | 240 | #define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME) |
239 | #define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH) | 241 | #define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH) |
240 | #define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP) | 242 | #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) |
241 | #define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) | 243 | #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) |
242 | #define nfserr_openmode __constant_htonl(NFSERR_OPENMODE) | 244 | #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) |
243 | #define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD) | 245 | #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) |
244 | #define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL) | 246 | #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) |
245 | #define nfserr_grace __constant_htonl(NFSERR_GRACE) | 247 | #define nfserr_grace cpu_to_be32(NFSERR_GRACE) |
246 | #define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE) | 248 | #define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE) |
247 | #define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) | 249 | #define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD) |
248 | #define nfserr_badname __constant_htonl(NFSERR_BADNAME) | 250 | #define nfserr_badname cpu_to_be32(NFSERR_BADNAME) |
249 | #define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) | 251 | #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) |
250 | #define nfserr_locked __constant_htonl(NFSERR_LOCKED) | 252 | #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) |
251 | #define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC) | 253 | #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) |
252 | #define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME) | 254 | #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) |
255 | #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) | ||
256 | #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) | ||
257 | #define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION) | ||
258 | #define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT) | ||
259 | #define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY) | ||
260 | #define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION) | ||
261 | #define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED) | ||
262 | #define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY) | ||
263 | #define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER) | ||
264 | #define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE) | ||
265 | #define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT) | ||
266 | #define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT) | ||
267 | #define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE) | ||
268 | #define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED) | ||
269 | #define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS) | ||
270 | #define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG) | ||
271 | #define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG) | ||
272 | #define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE) | ||
273 | #define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP) | ||
274 | #define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND) | ||
275 | #define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS) | ||
276 | #define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION) | ||
277 | #define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP) | ||
278 | #define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY) | ||
279 | #define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE) | ||
280 | #define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY) | ||
281 | #define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT) | ||
282 | #define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION) | ||
283 | #define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP) | ||
284 | #define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT) | ||
285 | #define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP) | ||
286 | #define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED) | ||
287 | #define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE) | ||
288 | #define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL) | ||
289 | #define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG) | ||
290 | #define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT) | ||
291 | #define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED) | ||
253 | 292 | ||
254 | /* error codes for internal use */ | 293 | /* error codes for internal use */ |
255 | /* if a request fails due to kmalloc failure, it gets dropped. | 294 | /* if a request fails due to kmalloc failure, it gets dropped. |
256 | * Client should resend eventually | 295 | * Client should resend eventually |
257 | */ | 296 | */ |
258 | #define nfserr_dropit __constant_htonl(30000) | 297 | #define nfserr_dropit cpu_to_be32(30000) |
259 | /* end-of-file indicator in readdir */ | 298 | /* end-of-file indicator in readdir */ |
260 | #define nfserr_eof __constant_htonl(30001) | 299 | #define nfserr_eof cpu_to_be32(30001) |
300 | /* replay detected */ | ||
301 | #define nfserr_replay_me cpu_to_be32(11001) | ||
302 | /* nfs41 replay detected */ | ||
303 | #define nfserr_replay_cache cpu_to_be32(11002) | ||
261 | 304 | ||
262 | /* Check for dir entries '.' and '..' */ | 305 | /* Check for dir entries '.' and '..' */ |
263 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) | 306 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) |
@@ -300,7 +343,7 @@ extern struct timeval nfssvc_boot; | |||
300 | * TIME_BACKUP (unlikely to be supported any time soon) | 343 | * TIME_BACKUP (unlikely to be supported any time soon) |
301 | * TIME_CREATE (unlikely to be supported any time soon) | 344 | * TIME_CREATE (unlikely to be supported any time soon) |
302 | */ | 345 | */ |
303 | #define NFSD_SUPPORTED_ATTRS_WORD0 \ | 346 | #define NFSD4_SUPPORTED_ATTRS_WORD0 \ |
304 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ | 347 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ |
305 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ | 348 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ |
306 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ | 349 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ |
@@ -312,7 +355,7 @@ extern struct timeval nfssvc_boot; | |||
312 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ | 355 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ |
313 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) | 356 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) |
314 | 357 | ||
315 | #define NFSD_SUPPORTED_ATTRS_WORD1 \ | 358 | #define NFSD4_SUPPORTED_ATTRS_WORD1 \ |
316 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ | 359 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ |
317 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ | 360 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ |
318 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | 361 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ |
@@ -320,6 +363,35 @@ extern struct timeval nfssvc_boot; | |||
320 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ | 363 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ |
321 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) | 364 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) |
322 | 365 | ||
366 | #define NFSD4_SUPPORTED_ATTRS_WORD2 0 | ||
367 | |||
368 | #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ | ||
369 | NFSD4_SUPPORTED_ATTRS_WORD0 | ||
370 | |||
371 | #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ | ||
372 | NFSD4_SUPPORTED_ATTRS_WORD1 | ||
373 | |||
374 | #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ | ||
375 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) | ||
376 | |||
377 | static inline u32 nfsd_suppattrs0(u32 minorversion) | ||
378 | { | ||
379 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 | ||
380 | : NFSD4_SUPPORTED_ATTRS_WORD0; | ||
381 | } | ||
382 | |||
383 | static inline u32 nfsd_suppattrs1(u32 minorversion) | ||
384 | { | ||
385 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1 | ||
386 | : NFSD4_SUPPORTED_ATTRS_WORD1; | ||
387 | } | ||
388 | |||
389 | static inline u32 nfsd_suppattrs2(u32 minorversion) | ||
390 | { | ||
391 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 | ||
392 | : NFSD4_SUPPORTED_ATTRS_WORD2; | ||
393 | } | ||
394 | |||
323 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ | 395 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ |
324 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ | 396 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ |
325 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | 397 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) |
@@ -330,6 +402,19 @@ extern struct timeval nfssvc_boot; | |||
330 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ | 402 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ |
331 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ | 403 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ |
332 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | 404 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) |
405 | #define NFSD_WRITEABLE_ATTRS_WORD2 0 | ||
406 | |||
407 | #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \ | ||
408 | NFSD_WRITEABLE_ATTRS_WORD0 | ||
409 | /* | ||
410 | * we currently store the exclusive create verifier in the v_{a,m}time | ||
411 | * attributes so the client can't set these at create time using EXCLUSIVE4_1 | ||
412 | */ | ||
413 | #define NFSD_SUPPATTR_EXCLCREAT_WORD1 \ | ||
414 | (NFSD_WRITEABLE_ATTRS_WORD1 & \ | ||
415 | ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)) | ||
416 | #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ | ||
417 | NFSD_WRITEABLE_ATTRS_WORD2 | ||
333 | 418 | ||
334 | #endif /* CONFIG_NFSD_V4 */ | 419 | #endif /* CONFIG_NFSD_V4 */ |
335 | 420 | ||
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index fa317f6c154b..afa19016c4a8 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -269,6 +269,13 @@ fh_copy(struct svc_fh *dst, struct svc_fh *src) | |||
269 | return dst; | 269 | return dst; |
270 | } | 270 | } |
271 | 271 | ||
272 | static inline void | ||
273 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
274 | { | ||
275 | dst->fh_size = src->fh_size; | ||
276 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
277 | } | ||
278 | |||
272 | static __inline__ struct svc_fh * | 279 | static __inline__ struct svc_fh * |
273 | fh_init(struct svc_fh *fhp, int maxsize) | 280 | fh_init(struct svc_fh *fhp, int maxsize) |
274 | { | 281 | { |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index 128298c0362d..4d61c873feed 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -66,8 +66,7 @@ struct nfs4_cb_recall { | |||
66 | u32 cbr_ident; | 66 | u32 cbr_ident; |
67 | int cbr_trunc; | 67 | int cbr_trunc; |
68 | stateid_t cbr_stateid; | 68 | stateid_t cbr_stateid; |
69 | u32 cbr_fhlen; | 69 | struct knfsd_fh cbr_fh; |
70 | char cbr_fhval[NFS4_FHSIZE]; | ||
71 | struct nfs4_delegation *cbr_dp; | 70 | struct nfs4_delegation *cbr_dp; |
72 | }; | 71 | }; |
73 | 72 | ||
@@ -86,8 +85,7 @@ struct nfs4_delegation { | |||
86 | }; | 85 | }; |
87 | 86 | ||
88 | #define dl_stateid dl_recall.cbr_stateid | 87 | #define dl_stateid dl_recall.cbr_stateid |
89 | #define dl_fhlen dl_recall.cbr_fhlen | 88 | #define dl_fh dl_recall.cbr_fh |
90 | #define dl_fhval dl_recall.cbr_fhval | ||
91 | 89 | ||
92 | /* client delegation callback info */ | 90 | /* client delegation callback info */ |
93 | struct nfs4_callback { | 91 | struct nfs4_callback { |
@@ -101,6 +99,64 @@ struct nfs4_callback { | |||
101 | struct rpc_clnt * cb_client; | 99 | struct rpc_clnt * cb_client; |
102 | }; | 100 | }; |
103 | 101 | ||
102 | /* Maximum number of slots per session. 128 is useful for long haul TCP */ | ||
103 | #define NFSD_MAX_SLOTS_PER_SESSION 128 | ||
104 | /* Maximum number of pages per slot cache entry */ | ||
105 | #define NFSD_PAGES_PER_SLOT 1 | ||
106 | /* Maximum number of operations per session compound */ | ||
107 | #define NFSD_MAX_OPS_PER_COMPOUND 16 | ||
108 | |||
109 | struct nfsd4_cache_entry { | ||
110 | __be32 ce_status; | ||
111 | struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ | ||
112 | struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; | ||
113 | int ce_cachethis; | ||
114 | short ce_resused; | ||
115 | int ce_opcnt; | ||
116 | int ce_rpchdrlen; | ||
117 | }; | ||
118 | |||
119 | struct nfsd4_slot { | ||
120 | bool sl_inuse; | ||
121 | u32 sl_seqid; | ||
122 | struct nfsd4_cache_entry sl_cache_entry; | ||
123 | }; | ||
124 | |||
125 | struct nfsd4_session { | ||
126 | struct kref se_ref; | ||
127 | struct list_head se_hash; /* hash by sessionid */ | ||
128 | struct list_head se_perclnt; | ||
129 | u32 se_flags; | ||
130 | struct nfs4_client *se_client; /* for expire_client */ | ||
131 | struct nfs4_sessionid se_sessionid; | ||
132 | u32 se_fmaxreq_sz; | ||
133 | u32 se_fmaxresp_sz; | ||
134 | u32 se_fmaxresp_cached; | ||
135 | u32 se_fmaxops; | ||
136 | u32 se_fnumslots; | ||
137 | struct nfsd4_slot se_slots[]; /* forward channel slots */ | ||
138 | }; | ||
139 | |||
140 | static inline void | ||
141 | nfsd4_put_session(struct nfsd4_session *ses) | ||
142 | { | ||
143 | extern void free_session(struct kref *kref); | ||
144 | kref_put(&ses->se_ref, free_session); | ||
145 | } | ||
146 | |||
147 | static inline void | ||
148 | nfsd4_get_session(struct nfsd4_session *ses) | ||
149 | { | ||
150 | kref_get(&ses->se_ref); | ||
151 | } | ||
152 | |||
153 | /* formatted contents of nfs4_sessionid */ | ||
154 | struct nfsd4_sessionid { | ||
155 | clientid_t clientid; | ||
156 | u32 sequence; | ||
157 | u32 reserved; | ||
158 | }; | ||
159 | |||
104 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | 160 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ |
105 | 161 | ||
106 | /* | 162 | /* |
@@ -132,6 +188,12 @@ struct nfs4_client { | |||
132 | struct nfs4_callback cl_callback; /* callback info */ | 188 | struct nfs4_callback cl_callback; /* callback info */ |
133 | atomic_t cl_count; /* ref count */ | 189 | atomic_t cl_count; /* ref count */ |
134 | u32 cl_firststate; /* recovery dir creation */ | 190 | u32 cl_firststate; /* recovery dir creation */ |
191 | |||
192 | /* for nfs41 */ | ||
193 | struct list_head cl_sessions; | ||
194 | struct nfsd4_slot cl_slot; /* create_session slot */ | ||
195 | u32 cl_exchange_flags; | ||
196 | struct nfs4_sessionid cl_sessionid; | ||
135 | }; | 197 | }; |
136 | 198 | ||
137 | /* struct nfs4_client_reset | 199 | /* struct nfs4_client_reset |
@@ -168,8 +230,7 @@ struct nfs4_replay { | |||
168 | unsigned int rp_buflen; | 230 | unsigned int rp_buflen; |
169 | char *rp_buf; | 231 | char *rp_buf; |
170 | unsigned intrp_allocated; | 232 | unsigned intrp_allocated; |
171 | int rp_openfh_len; | 233 | struct knfsd_fh rp_openfh; |
172 | char rp_openfh[NFS4_FHSIZE]; | ||
173 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; | 234 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; |
174 | }; | 235 | }; |
175 | 236 | ||
@@ -217,7 +278,7 @@ struct nfs4_stateowner { | |||
217 | * share_acces, share_deny on the file. | 278 | * share_acces, share_deny on the file. |
218 | */ | 279 | */ |
219 | struct nfs4_file { | 280 | struct nfs4_file { |
220 | struct kref fi_ref; | 281 | atomic_t fi_ref; |
221 | struct list_head fi_hash; /* hash by "struct inode *" */ | 282 | struct list_head fi_hash; /* hash by "struct inode *" */ |
222 | struct list_head fi_stateids; | 283 | struct list_head fi_stateids; |
223 | struct list_head fi_delegations; | 284 | struct list_head fi_delegations; |
@@ -259,14 +320,13 @@ struct nfs4_stateid { | |||
259 | }; | 320 | }; |
260 | 321 | ||
261 | /* flags for preprocess_seqid_op() */ | 322 | /* flags for preprocess_seqid_op() */ |
262 | #define CHECK_FH 0x00000001 | 323 | #define HAS_SESSION 0x00000001 |
263 | #define CONFIRM 0x00000002 | 324 | #define CONFIRM 0x00000002 |
264 | #define OPEN_STATE 0x00000004 | 325 | #define OPEN_STATE 0x00000004 |
265 | #define LOCK_STATE 0x00000008 | 326 | #define LOCK_STATE 0x00000008 |
266 | #define RD_STATE 0x00000010 | 327 | #define RD_STATE 0x00000010 |
267 | #define WR_STATE 0x00000020 | 328 | #define WR_STATE 0x00000020 |
268 | #define CLOSE_STATE 0x00000040 | 329 | #define CLOSE_STATE 0x00000040 |
269 | #define DELEG_RET 0x00000080 | ||
270 | 330 | ||
271 | #define seqid_mutating_err(err) \ | 331 | #define seqid_mutating_err(err) \ |
272 | (((err) != nfserr_stale_clientid) && \ | 332 | (((err) != nfserr_stale_clientid) && \ |
@@ -274,7 +334,9 @@ struct nfs4_stateid { | |||
274 | ((err) != nfserr_stale_stateid) && \ | 334 | ((err) != nfserr_stale_stateid) && \ |
275 | ((err) != nfserr_bad_stateid)) | 335 | ((err) != nfserr_bad_stateid)) |
276 | 336 | ||
277 | extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh, | 337 | struct nfsd4_compound_state; |
338 | |||
339 | extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | ||
278 | stateid_t *stateid, int flags, struct file **filp); | 340 | stateid_t *stateid, int flags, struct file **filp); |
279 | extern void nfs4_lock_state(void); | 341 | extern void nfs4_lock_state(void); |
280 | extern void nfs4_unlock_state(void); | 342 | extern void nfs4_unlock_state(void); |
@@ -290,7 +352,7 @@ extern void nfsd4_init_recdir(char *recdir_name); | |||
290 | extern int nfsd4_recdir_load(void); | 352 | extern int nfsd4_recdir_load(void); |
291 | extern void nfsd4_shutdown_recdir(void); | 353 | extern void nfsd4_shutdown_recdir(void); |
292 | extern int nfs4_client_to_reclaim(const char *name); | 354 | extern int nfs4_client_to_reclaim(const char *name); |
293 | extern int nfs4_has_reclaimed_state(const char *name); | 355 | extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id); |
294 | extern void nfsd4_recdir_purge_old(void); | 356 | extern void nfsd4_recdir_purge_old(void); |
295 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | 357 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); |
296 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | 358 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); |
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h index 7678cfbe9960..2693ef647df6 100644 --- a/include/linux/nfsd/stats.h +++ b/include/linux/nfsd/stats.h | |||
@@ -11,6 +11,11 @@ | |||
11 | 11 | ||
12 | #include <linux/nfs4.h> | 12 | #include <linux/nfs4.h> |
13 | 13 | ||
14 | /* thread usage wraps very million seconds (approx one fortnight) */ | ||
15 | #define NFSD_USAGE_WRAP (HZ*1000000) | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | |||
14 | struct nfsd_stats { | 19 | struct nfsd_stats { |
15 | unsigned int rchits; /* repcache hits */ | 20 | unsigned int rchits; /* repcache hits */ |
16 | unsigned int rcmisses; /* repcache hits */ | 21 | unsigned int rcmisses; /* repcache hits */ |
@@ -35,10 +40,6 @@ struct nfsd_stats { | |||
35 | 40 | ||
36 | }; | 41 | }; |
37 | 42 | ||
38 | /* thread usage wraps very million seconds (approx one fortnight) */ | ||
39 | #define NFSD_USAGE_WRAP (HZ*1000000) | ||
40 | |||
41 | #ifdef __KERNEL__ | ||
42 | 43 | ||
43 | extern struct nfsd_stats nfsdstats; | 44 | extern struct nfsd_stats nfsdstats; |
44 | extern struct svc_stat nfsd_svcstats; | 45 | extern struct svc_stat nfsd_svcstats; |
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index 27bd3e38ec5a..f80d6013fdc3 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
@@ -45,10 +45,22 @@ | |||
45 | #define XDR_LEN(n) (((n) + 3) & ~3) | 45 | #define XDR_LEN(n) (((n) + 3) & ~3) |
46 | 46 | ||
47 | struct nfsd4_compound_state { | 47 | struct nfsd4_compound_state { |
48 | struct svc_fh current_fh; | 48 | struct svc_fh current_fh; |
49 | struct svc_fh save_fh; | 49 | struct svc_fh save_fh; |
50 | struct nfs4_stateowner *replay_owner; | 50 | struct nfs4_stateowner *replay_owner; |
51 | }; | 51 | /* For sessions DRC */ |
52 | struct nfsd4_session *session; | ||
53 | struct nfsd4_slot *slot; | ||
54 | __be32 *statp; | ||
55 | size_t iovlen; | ||
56 | u32 minorversion; | ||
57 | u32 status; | ||
58 | }; | ||
59 | |||
60 | static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) | ||
61 | { | ||
62 | return cs->slot != NULL; | ||
63 | } | ||
52 | 64 | ||
53 | struct nfsd4_change_info { | 65 | struct nfsd4_change_info { |
54 | u32 atomic; | 66 | u32 atomic; |
@@ -90,7 +102,7 @@ struct nfsd4_create { | |||
90 | u32 specdata2; | 102 | u32 specdata2; |
91 | } dev; /* NF4BLK, NF4CHR */ | 103 | } dev; /* NF4BLK, NF4CHR */ |
92 | } u; | 104 | } u; |
93 | u32 cr_bmval[2]; /* request */ | 105 | u32 cr_bmval[3]; /* request */ |
94 | struct iattr cr_iattr; /* request */ | 106 | struct iattr cr_iattr; /* request */ |
95 | struct nfsd4_change_info cr_cinfo; /* response */ | 107 | struct nfsd4_change_info cr_cinfo; /* response */ |
96 | struct nfs4_acl *cr_acl; | 108 | struct nfs4_acl *cr_acl; |
@@ -105,7 +117,7 @@ struct nfsd4_delegreturn { | |||
105 | }; | 117 | }; |
106 | 118 | ||
107 | struct nfsd4_getattr { | 119 | struct nfsd4_getattr { |
108 | u32 ga_bmval[2]; /* request */ | 120 | u32 ga_bmval[3]; /* request */ |
109 | struct svc_fh *ga_fhp; /* response */ | 121 | struct svc_fh *ga_fhp; /* response */ |
110 | }; | 122 | }; |
111 | 123 | ||
@@ -206,11 +218,9 @@ struct nfsd4_open { | |||
206 | stateid_t op_delegate_stateid; /* request - response */ | 218 | stateid_t op_delegate_stateid; /* request - response */ |
207 | u32 op_create; /* request */ | 219 | u32 op_create; /* request */ |
208 | u32 op_createmode; /* request */ | 220 | u32 op_createmode; /* request */ |
209 | u32 op_bmval[2]; /* request */ | 221 | u32 op_bmval[3]; /* request */ |
210 | union { /* request */ | 222 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ |
211 | struct iattr iattr; /* UNCHECKED4,GUARDED4 */ | 223 | nfs4_verifier verf; /* EXCLUSIVE4 */ |
212 | nfs4_verifier verf; /* EXCLUSIVE4 */ | ||
213 | } u; | ||
214 | clientid_t op_clientid; /* request */ | 224 | clientid_t op_clientid; /* request */ |
215 | struct xdr_netobj op_owner; /* request */ | 225 | struct xdr_netobj op_owner; /* request */ |
216 | u32 op_seqid; /* request */ | 226 | u32 op_seqid; /* request */ |
@@ -224,8 +234,8 @@ struct nfsd4_open { | |||
224 | struct nfs4_stateowner *op_stateowner; /* used during processing */ | 234 | struct nfs4_stateowner *op_stateowner; /* used during processing */ |
225 | struct nfs4_acl *op_acl; | 235 | struct nfs4_acl *op_acl; |
226 | }; | 236 | }; |
227 | #define op_iattr u.iattr | 237 | #define op_iattr iattr |
228 | #define op_verf u.verf | 238 | #define op_verf verf |
229 | 239 | ||
230 | struct nfsd4_open_confirm { | 240 | struct nfsd4_open_confirm { |
231 | stateid_t oc_req_stateid /* request */; | 241 | stateid_t oc_req_stateid /* request */; |
@@ -259,7 +269,7 @@ struct nfsd4_readdir { | |||
259 | nfs4_verifier rd_verf; /* request */ | 269 | nfs4_verifier rd_verf; /* request */ |
260 | u32 rd_dircount; /* request */ | 270 | u32 rd_dircount; /* request */ |
261 | u32 rd_maxcount; /* request */ | 271 | u32 rd_maxcount; /* request */ |
262 | u32 rd_bmval[2]; /* request */ | 272 | u32 rd_bmval[3]; /* request */ |
263 | struct svc_rqst *rd_rqstp; /* response */ | 273 | struct svc_rqst *rd_rqstp; /* response */ |
264 | struct svc_fh * rd_fhp; /* response */ | 274 | struct svc_fh * rd_fhp; /* response */ |
265 | 275 | ||
@@ -301,7 +311,7 @@ struct nfsd4_secinfo { | |||
301 | 311 | ||
302 | struct nfsd4_setattr { | 312 | struct nfsd4_setattr { |
303 | stateid_t sa_stateid; /* request */ | 313 | stateid_t sa_stateid; /* request */ |
304 | u32 sa_bmval[2]; /* request */ | 314 | u32 sa_bmval[3]; /* request */ |
305 | struct iattr sa_iattr; /* request */ | 315 | struct iattr sa_iattr; /* request */ |
306 | struct nfs4_acl *sa_acl; | 316 | struct nfs4_acl *sa_acl; |
307 | }; | 317 | }; |
@@ -327,7 +337,7 @@ struct nfsd4_setclientid_confirm { | |||
327 | 337 | ||
328 | /* also used for NVERIFY */ | 338 | /* also used for NVERIFY */ |
329 | struct nfsd4_verify { | 339 | struct nfsd4_verify { |
330 | u32 ve_bmval[2]; /* request */ | 340 | u32 ve_bmval[3]; /* request */ |
331 | u32 ve_attrlen; /* request */ | 341 | u32 ve_attrlen; /* request */ |
332 | char * ve_attrval; /* request */ | 342 | char * ve_attrval; /* request */ |
333 | }; | 343 | }; |
@@ -344,6 +354,54 @@ struct nfsd4_write { | |||
344 | nfs4_verifier wr_verifier; /* response */ | 354 | nfs4_verifier wr_verifier; /* response */ |
345 | }; | 355 | }; |
346 | 356 | ||
357 | struct nfsd4_exchange_id { | ||
358 | nfs4_verifier verifier; | ||
359 | struct xdr_netobj clname; | ||
360 | u32 flags; | ||
361 | clientid_t clientid; | ||
362 | u32 seqid; | ||
363 | int spa_how; | ||
364 | }; | ||
365 | |||
366 | struct nfsd4_channel_attrs { | ||
367 | u32 headerpadsz; | ||
368 | u32 maxreq_sz; | ||
369 | u32 maxresp_sz; | ||
370 | u32 maxresp_cached; | ||
371 | u32 maxops; | ||
372 | u32 maxreqs; | ||
373 | u32 nr_rdma_attrs; | ||
374 | u32 rdma_attrs; | ||
375 | }; | ||
376 | |||
377 | struct nfsd4_create_session { | ||
378 | clientid_t clientid; | ||
379 | struct nfs4_sessionid sessionid; | ||
380 | u32 seqid; | ||
381 | u32 flags; | ||
382 | struct nfsd4_channel_attrs fore_channel; | ||
383 | struct nfsd4_channel_attrs back_channel; | ||
384 | u32 callback_prog; | ||
385 | u32 uid; | ||
386 | u32 gid; | ||
387 | }; | ||
388 | |||
389 | struct nfsd4_sequence { | ||
390 | struct nfs4_sessionid sessionid; /* request/response */ | ||
391 | u32 seqid; /* request/response */ | ||
392 | u32 slotid; /* request/response */ | ||
393 | u32 maxslots; /* request/response */ | ||
394 | u32 cachethis; /* request */ | ||
395 | #if 0 | ||
396 | u32 target_maxslots; /* response */ | ||
397 | u32 status_flags; /* response */ | ||
398 | #endif /* not yet */ | ||
399 | }; | ||
400 | |||
401 | struct nfsd4_destroy_session { | ||
402 | struct nfs4_sessionid sessionid; | ||
403 | }; | ||
404 | |||
347 | struct nfsd4_op { | 405 | struct nfsd4_op { |
348 | int opnum; | 406 | int opnum; |
349 | __be32 status; | 407 | __be32 status; |
@@ -378,6 +436,12 @@ struct nfsd4_op { | |||
378 | struct nfsd4_verify verify; | 436 | struct nfsd4_verify verify; |
379 | struct nfsd4_write write; | 437 | struct nfsd4_write write; |
380 | struct nfsd4_release_lockowner release_lockowner; | 438 | struct nfsd4_release_lockowner release_lockowner; |
439 | |||
440 | /* NFSv4.1 */ | ||
441 | struct nfsd4_exchange_id exchange_id; | ||
442 | struct nfsd4_create_session create_session; | ||
443 | struct nfsd4_destroy_session destroy_session; | ||
444 | struct nfsd4_sequence sequence; | ||
381 | } u; | 445 | } u; |
382 | struct nfs4_replay * replay; | 446 | struct nfs4_replay * replay; |
383 | }; | 447 | }; |
@@ -416,9 +480,22 @@ struct nfsd4_compoundres { | |||
416 | u32 taglen; | 480 | u32 taglen; |
417 | char * tag; | 481 | char * tag; |
418 | u32 opcnt; | 482 | u32 opcnt; |
419 | __be32 * tagp; /* where to encode tag and opcount */ | 483 | __be32 * tagp; /* tag, opcount encode location */ |
484 | struct nfsd4_compound_state cstate; | ||
420 | }; | 485 | }; |
421 | 486 | ||
487 | static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) | ||
488 | { | ||
489 | struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; | ||
490 | return args->opcnt == 1; | ||
491 | } | ||
492 | |||
493 | static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | ||
494 | { | ||
495 | return !resp->cstate.slot->sl_cache_entry.ce_cachethis || | ||
496 | nfsd4_is_solo_sequence(resp); | ||
497 | } | ||
498 | |||
422 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) | 499 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) |
423 | 500 | ||
424 | static inline void | 501 | static inline void |
@@ -448,7 +525,23 @@ extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, | |||
448 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | 525 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, |
449 | struct nfsd4_compound_state *, | 526 | struct nfsd4_compound_state *, |
450 | struct nfsd4_setclientid_confirm *setclientid_confirm); | 527 | struct nfsd4_setclientid_confirm *setclientid_confirm); |
451 | extern __be32 nfsd4_process_open1(struct nfsd4_open *open); | 528 | extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp); |
529 | extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp, | ||
530 | struct nfsd4_sequence *seq); | ||
531 | extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp, | ||
532 | struct nfsd4_compound_state *, | ||
533 | struct nfsd4_exchange_id *); | ||
534 | extern __be32 nfsd4_create_session(struct svc_rqst *, | ||
535 | struct nfsd4_compound_state *, | ||
536 | struct nfsd4_create_session *); | ||
537 | extern __be32 nfsd4_sequence(struct svc_rqst *, | ||
538 | struct nfsd4_compound_state *, | ||
539 | struct nfsd4_sequence *); | ||
540 | extern __be32 nfsd4_destroy_session(struct svc_rqst *, | ||
541 | struct nfsd4_compound_state *, | ||
542 | struct nfsd4_destroy_session *); | ||
543 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, | ||
544 | struct nfsd4_open *open); | ||
452 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, | 545 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, |
453 | struct svc_fh *current_fh, struct nfsd4_open *open); | 546 | struct svc_fh *current_fh, struct nfsd4_open *open); |
454 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, | 547 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, |
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h new file mode 100644 index 000000000000..79fec6af3f9f --- /dev/null +++ b/include/linux/nilfs2_fs.h | |||
@@ -0,0 +1,801 @@ | |||
1 | /* | ||
2 | * nilfs2_fs.h - NILFS2 on-disk structures and common declarations. | ||
3 | * | ||
4 | * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. | ||
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | * | ||
20 | * Written by Koji Sato <koji@osrg.net> | ||
21 | * Ryusuke Konishi <ryusuke@osrg.net> | ||
22 | */ | ||
23 | /* | ||
24 | * linux/include/linux/ext2_fs.h | ||
25 | * | ||
26 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
27 | * Remy Card (card@masi.ibp.fr) | ||
28 | * Laboratoire MASI - Institut Blaise Pascal | ||
29 | * Universite Pierre et Marie Curie (Paris VI) | ||
30 | * | ||
31 | * from | ||
32 | * | ||
33 | * linux/include/linux/minix_fs.h | ||
34 | * | ||
35 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
36 | */ | ||
37 | |||
38 | #ifndef _LINUX_NILFS_FS_H | ||
39 | #define _LINUX_NILFS_FS_H | ||
40 | |||
41 | #include <linux/types.h> | ||
42 | #include <linux/ioctl.h> | ||
43 | |||
44 | /* | ||
45 | * Inode flags stored in nilfs_inode and on-memory nilfs inode | ||
46 | * | ||
47 | * We define these flags based on ext2-fs because of the | ||
48 | * compatibility reason; to avoid problems in chattr(1) | ||
49 | */ | ||
50 | #define NILFS_SECRM_FL 0x00000001 /* Secure deletion */ | ||
51 | #define NILFS_UNRM_FL 0x00000002 /* Undelete */ | ||
52 | #define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */ | ||
53 | #define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */ | ||
54 | #define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */ | ||
55 | #define NILFS_NODUMP_FL 0x00000040 /* do not dump file */ | ||
56 | #define NILFS_NOATIME_FL 0x00000080 /* do not update atime */ | ||
57 | /* Reserved for compression usage... */ | ||
58 | #define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | ||
59 | #define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */ | ||
60 | |||
61 | #define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | ||
62 | #define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ | ||
63 | |||
64 | |||
65 | #define NILFS_INODE_BMAP_SIZE 7 | ||
66 | /** | ||
67 | * struct nilfs_inode - structure of an inode on disk | ||
68 | * @i_blocks: blocks count | ||
69 | * @i_size: size in bytes | ||
70 | * @i_ctime: creation time (seconds) | ||
71 | * @i_mtime: modification time (seconds) | ||
72 | * @i_ctime_nsec: creation time (nano seconds) | ||
73 | * @i_mtime_nsec: modification time (nano seconds) | ||
74 | * @i_uid: user id | ||
75 | * @i_gid: group id | ||
76 | * @i_mode: file mode | ||
77 | * @i_links_count: links count | ||
78 | * @i_flags: file flags | ||
79 | * @i_bmap: block mapping | ||
80 | * @i_xattr: extended attributes | ||
81 | * @i_generation: file generation (for NFS) | ||
82 | * @i_pad: padding | ||
83 | */ | ||
84 | struct nilfs_inode { | ||
85 | __le64 i_blocks; | ||
86 | __le64 i_size; | ||
87 | __le64 i_ctime; | ||
88 | __le64 i_mtime; | ||
89 | __le32 i_ctime_nsec; | ||
90 | __le32 i_mtime_nsec; | ||
91 | __le32 i_uid; | ||
92 | __le32 i_gid; | ||
93 | __le16 i_mode; | ||
94 | __le16 i_links_count; | ||
95 | __le32 i_flags; | ||
96 | __le64 i_bmap[NILFS_INODE_BMAP_SIZE]; | ||
97 | #define i_device_code i_bmap[0] | ||
98 | __le64 i_xattr; | ||
99 | __le32 i_generation; | ||
100 | __le32 i_pad; | ||
101 | }; | ||
102 | |||
103 | /** | ||
104 | * struct nilfs_super_root - structure of super root | ||
105 | * @sr_sum: check sum | ||
106 | * @sr_bytes: byte count of the structure | ||
107 | * @sr_flags: flags (reserved) | ||
108 | * @sr_nongc_ctime: write time of the last segment not for cleaner operation | ||
109 | * @sr_dat: DAT file inode | ||
110 | * @sr_cpfile: checkpoint file inode | ||
111 | * @sr_sufile: segment usage file inode | ||
112 | */ | ||
113 | struct nilfs_super_root { | ||
114 | __le32 sr_sum; | ||
115 | __le16 sr_bytes; | ||
116 | __le16 sr_flags; | ||
117 | __le64 sr_nongc_ctime; | ||
118 | struct nilfs_inode sr_dat; | ||
119 | struct nilfs_inode sr_cpfile; | ||
120 | struct nilfs_inode sr_sufile; | ||
121 | }; | ||
122 | |||
123 | #define NILFS_SR_MDT_OFFSET(inode_size, i) \ | ||
124 | ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \ | ||
125 | (inode_size) * (i)) | ||
126 | #define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0) | ||
127 | #define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1) | ||
128 | #define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) | ||
129 | #define NILFS_SR_BYTES (sizeof(struct nilfs_super_root)) | ||
130 | |||
131 | /* | ||
132 | * Maximal mount counts | ||
133 | */ | ||
134 | #define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */ | ||
135 | |||
136 | /* | ||
137 | * File system states (sbp->s_state, nilfs->ns_mount_state) | ||
138 | */ | ||
139 | #define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
140 | #define NILFS_ERROR_FS 0x0002 /* Errors detected */ | ||
141 | #define NILFS_RESIZE_FS 0x0004 /* Resize required */ | ||
142 | |||
143 | /* | ||
144 | * Mount flags (sbi->s_mount_opt) | ||
145 | */ | ||
146 | #define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */ | ||
147 | #define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ | ||
148 | #define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ | ||
149 | #define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ | ||
150 | #define NILFS_MOUNT_SNAPSHOT 0x0080 /* Snapshot flag */ | ||
151 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ | ||
152 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order | ||
153 | semantics also for data */ | ||
154 | |||
155 | |||
156 | /** | ||
157 | * struct nilfs_super_block - structure of super block on disk | ||
158 | */ | ||
159 | struct nilfs_super_block { | ||
160 | __le32 s_rev_level; /* Revision level */ | ||
161 | __le16 s_minor_rev_level; /* minor revision level */ | ||
162 | __le16 s_magic; /* Magic signature */ | ||
163 | |||
164 | __le16 s_bytes; /* Bytes count of CRC calculation | ||
165 | for this structure. s_reserved | ||
166 | is excluded. */ | ||
167 | __le16 s_flags; /* flags */ | ||
168 | __le32 s_crc_seed; /* Seed value of CRC calculation */ | ||
169 | __le32 s_sum; /* Check sum of super block */ | ||
170 | |||
171 | __le32 s_log_block_size; /* Block size represented as follows | ||
172 | blocksize = | ||
173 | 1 << (s_log_block_size + 10) */ | ||
174 | __le64 s_nsegments; /* Number of segments in filesystem */ | ||
175 | __le64 s_dev_size; /* block device size in bytes */ | ||
176 | __le64 s_first_data_block; /* 1st seg disk block number */ | ||
177 | __le32 s_blocks_per_segment; /* number of blocks per full segment */ | ||
178 | __le32 s_r_segments_percentage; /* Reserved segments percentage */ | ||
179 | |||
180 | __le64 s_last_cno; /* Last checkpoint number */ | ||
181 | __le64 s_last_pseg; /* disk block addr pseg written last */ | ||
182 | __le64 s_last_seq; /* seq. number of seg written last */ | ||
183 | __le64 s_free_blocks_count; /* Free blocks count */ | ||
184 | |||
185 | __le64 s_ctime; /* Creation time (execution time of | ||
186 | newfs) */ | ||
187 | __le64 s_mtime; /* Mount time */ | ||
188 | __le64 s_wtime; /* Write time */ | ||
189 | __le16 s_mnt_count; /* Mount count */ | ||
190 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
191 | __le16 s_state; /* File system state */ | ||
192 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
193 | __le64 s_lastcheck; /* time of last check */ | ||
194 | |||
195 | __le32 s_checkinterval; /* max. time between checks */ | ||
196 | __le32 s_creator_os; /* OS */ | ||
197 | __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
198 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
199 | __le32 s_first_ino; /* First non-reserved inode */ | ||
200 | |||
201 | __le16 s_inode_size; /* Size of an inode */ | ||
202 | __le16 s_dat_entry_size; /* Size of a dat entry */ | ||
203 | __le16 s_checkpoint_size; /* Size of a checkpoint */ | ||
204 | __le16 s_segment_usage_size; /* Size of a segment usage */ | ||
205 | |||
206 | __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
207 | char s_volume_name[16]; /* volume name */ | ||
208 | char s_last_mounted[64]; /* directory where last mounted */ | ||
209 | |||
210 | __le32 s_c_interval; /* Commit interval of segment */ | ||
211 | __le32 s_c_block_max; /* Threshold of data amount for | ||
212 | the segment construction */ | ||
213 | __u32 s_reserved[192]; /* padding to the end of the block */ | ||
214 | }; | ||
215 | |||
216 | /* | ||
217 | * Codes for operating systems | ||
218 | */ | ||
219 | #define NILFS_OS_LINUX 0 | ||
220 | /* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */ | ||
221 | |||
222 | /* | ||
223 | * Revision levels | ||
224 | */ | ||
225 | #define NILFS_CURRENT_REV 2 /* current major revision */ | ||
226 | #define NILFS_MINOR_REV 0 /* minor revision */ | ||
227 | |||
228 | /* | ||
229 | * Bytes count of super_block for CRC-calculation | ||
230 | */ | ||
231 | #define NILFS_SB_BYTES \ | ||
232 | ((long)&((struct nilfs_super_block *)0)->s_reserved) | ||
233 | |||
234 | /* | ||
235 | * Special inode number | ||
236 | */ | ||
237 | #define NILFS_ROOT_INO 2 /* Root file inode */ | ||
238 | #define NILFS_DAT_INO 3 /* DAT file */ | ||
239 | #define NILFS_CPFILE_INO 4 /* checkpoint file */ | ||
240 | #define NILFS_SUFILE_INO 5 /* segment usage file */ | ||
241 | #define NILFS_IFILE_INO 6 /* ifile */ | ||
242 | #define NILFS_ATIME_INO 7 /* Atime file (reserved) */ | ||
243 | #define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */ | ||
244 | #define NILFS_SKETCH_INO 10 /* Sketch file */ | ||
245 | #define NILFS_USER_INO 11 /* Fisrt user's file inode number */ | ||
246 | |||
247 | #define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ | ||
248 | #define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */ | ||
249 | |||
250 | #define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in | ||
251 | a full segment */ | ||
252 | #define NILFS_PSEG_MIN_BLOCKS 2 /* Minimum number of blocks in | ||
253 | a partial segment */ | ||
254 | #define NILFS_MIN_NRSVSEGS 8 /* Minimum number of reserved | ||
255 | segments */ | ||
256 | |||
257 | /* | ||
258 | * bytes offset of secondary super block | ||
259 | */ | ||
260 | #define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12) | ||
261 | |||
262 | /* | ||
263 | * Maximal count of links to a file | ||
264 | */ | ||
265 | #define NILFS_LINK_MAX 32000 | ||
266 | |||
267 | /* | ||
268 | * Structure of a directory entry | ||
269 | * (Same as ext2) | ||
270 | */ | ||
271 | |||
272 | #define NILFS_NAME_LEN 255 | ||
273 | |||
274 | /* | ||
275 | * The new version of the directory entry. Since V0 structures are | ||
276 | * stored in intel byte order, and the name_len field could never be | ||
277 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
278 | * file_type field. | ||
279 | */ | ||
280 | struct nilfs_dir_entry { | ||
281 | __le64 inode; /* Inode number */ | ||
282 | __le16 rec_len; /* Directory entry length */ | ||
283 | __u8 name_len; /* Name length */ | ||
284 | __u8 file_type; | ||
285 | char name[NILFS_NAME_LEN]; /* File name */ | ||
286 | char pad; | ||
287 | }; | ||
288 | |||
289 | /* | ||
290 | * NILFS directory file types. Only the low 3 bits are used. The | ||
291 | * other bits are reserved for now. | ||
292 | */ | ||
293 | enum { | ||
294 | NILFS_FT_UNKNOWN, | ||
295 | NILFS_FT_REG_FILE, | ||
296 | NILFS_FT_DIR, | ||
297 | NILFS_FT_CHRDEV, | ||
298 | NILFS_FT_BLKDEV, | ||
299 | NILFS_FT_FIFO, | ||
300 | NILFS_FT_SOCK, | ||
301 | NILFS_FT_SYMLINK, | ||
302 | NILFS_FT_MAX | ||
303 | }; | ||
304 | |||
305 | /* | ||
306 | * NILFS_DIR_PAD defines the directory entries boundaries | ||
307 | * | ||
308 | * NOTE: It must be a multiple of 8 | ||
309 | */ | ||
310 | #define NILFS_DIR_PAD 8 | ||
311 | #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) | ||
312 | #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ | ||
313 | ~NILFS_DIR_ROUND) | ||
314 | |||
315 | |||
316 | /** | ||
317 | * struct nilfs_finfo - file information | ||
318 | * @fi_ino: inode number | ||
319 | * @fi_cno: checkpoint number | ||
320 | * @fi_nblocks: number of blocks (including intermediate blocks) | ||
321 | * @fi_ndatablk: number of file data blocks | ||
322 | */ | ||
323 | struct nilfs_finfo { | ||
324 | __le64 fi_ino; | ||
325 | __le64 fi_cno; | ||
326 | __le32 fi_nblocks; | ||
327 | __le32 fi_ndatablk; | ||
328 | /* array of virtual block numbers */ | ||
329 | }; | ||
330 | |||
331 | /** | ||
332 | * struct nilfs_binfo_v - information for the block to which a virtual block number is assigned | ||
333 | * @bi_vblocknr: virtual block number | ||
334 | * @bi_blkoff: block offset | ||
335 | */ | ||
336 | struct nilfs_binfo_v { | ||
337 | __le64 bi_vblocknr; | ||
338 | __le64 bi_blkoff; | ||
339 | }; | ||
340 | |||
341 | /** | ||
342 | * struct nilfs_binfo_dat - information for the block which belongs to the DAT file | ||
343 | * @bi_blkoff: block offset | ||
344 | * @bi_level: level | ||
345 | * @bi_pad: padding | ||
346 | */ | ||
347 | struct nilfs_binfo_dat { | ||
348 | __le64 bi_blkoff; | ||
349 | __u8 bi_level; | ||
350 | __u8 bi_pad[7]; | ||
351 | }; | ||
352 | |||
353 | /** | ||
354 | * union nilfs_binfo: block information | ||
355 | * @bi_v: nilfs_binfo_v structure | ||
356 | * @bi_dat: nilfs_binfo_dat structure | ||
357 | */ | ||
358 | union nilfs_binfo { | ||
359 | struct nilfs_binfo_v bi_v; | ||
360 | struct nilfs_binfo_dat bi_dat; | ||
361 | }; | ||
362 | |||
363 | /** | ||
364 | * struct nilfs_segment_summary - segment summary | ||
365 | * @ss_datasum: checksum of data | ||
366 | * @ss_sumsum: checksum of segment summary | ||
367 | * @ss_magic: magic number | ||
368 | * @ss_bytes: size of this structure in bytes | ||
369 | * @ss_flags: flags | ||
370 | * @ss_seq: sequence number | ||
371 | * @ss_create: creation timestamp | ||
372 | * @ss_next: next segment | ||
373 | * @ss_nblocks: number of blocks | ||
374 | * @ss_nfinfo: number of finfo structures | ||
375 | * @ss_sumbytes: total size of segment summary in bytes | ||
376 | * @ss_pad: padding | ||
377 | */ | ||
378 | struct nilfs_segment_summary { | ||
379 | __le32 ss_datasum; | ||
380 | __le32 ss_sumsum; | ||
381 | __le32 ss_magic; | ||
382 | __le16 ss_bytes; | ||
383 | __le16 ss_flags; | ||
384 | __le64 ss_seq; | ||
385 | __le64 ss_create; | ||
386 | __le64 ss_next; | ||
387 | __le32 ss_nblocks; | ||
388 | __le32 ss_nfinfo; | ||
389 | __le32 ss_sumbytes; | ||
390 | __le32 ss_pad; | ||
391 | /* array of finfo structures */ | ||
392 | }; | ||
393 | |||
394 | #define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */ | ||
395 | |||
396 | /* | ||
397 | * Segment summary flags | ||
398 | */ | ||
399 | #define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */ | ||
400 | #define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */ | ||
401 | #define NILFS_SS_SR 0x0004 /* has super root */ | ||
402 | #define NILFS_SS_SYNDT 0x0008 /* includes data only updates */ | ||
403 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ | ||
404 | |||
405 | /** | ||
406 | * struct nilfs_palloc_group_desc - block group descriptor | ||
407 | * @pg_nfrees: number of free entries in block group | ||
408 | */ | ||
409 | struct nilfs_palloc_group_desc { | ||
410 | __le32 pg_nfrees; | ||
411 | }; | ||
412 | |||
413 | /** | ||
414 | * struct nilfs_dat_entry - disk address translation entry | ||
415 | * @dt_blocknr: block number | ||
416 | * @dt_start: start checkpoint number | ||
417 | * @dt_end: end checkpoint number | ||
418 | * @dt_rsv: reserved for future use | ||
419 | */ | ||
420 | struct nilfs_dat_entry { | ||
421 | __le64 de_blocknr; | ||
422 | __le64 de_start; | ||
423 | __le64 de_end; | ||
424 | __le64 de_rsv; | ||
425 | }; | ||
426 | |||
427 | /** | ||
428 | * struct nilfs_dat_group_desc - block group descriptor | ||
429 | * @dg_nfrees: number of free virtual block numbers in block group | ||
430 | */ | ||
431 | struct nilfs_dat_group_desc { | ||
432 | __le32 dg_nfrees; | ||
433 | }; | ||
434 | |||
435 | |||
436 | /** | ||
437 | * struct nilfs_snapshot_list - snapshot list | ||
438 | * @ssl_next: next checkpoint number on snapshot list | ||
439 | * @ssl_prev: previous checkpoint number on snapshot list | ||
440 | */ | ||
441 | struct nilfs_snapshot_list { | ||
442 | __le64 ssl_next; | ||
443 | __le64 ssl_prev; | ||
444 | }; | ||
445 | |||
446 | /** | ||
447 | * struct nilfs_checkpoint - checkpoint structure | ||
448 | * @cp_flags: flags | ||
449 | * @cp_checkpoints_count: checkpoints count in a block | ||
450 | * @cp_snapshot_list: snapshot list | ||
451 | * @cp_cno: checkpoint number | ||
452 | * @cp_create: creation timestamp | ||
453 | * @cp_nblk_inc: number of blocks incremented by this checkpoint | ||
454 | * @cp_inodes_count: inodes count | ||
455 | * @cp_blocks_count: blocks count | ||
456 | * @cp_ifile_inode: inode of ifile | ||
457 | */ | ||
458 | struct nilfs_checkpoint { | ||
459 | __le32 cp_flags; | ||
460 | __le32 cp_checkpoints_count; | ||
461 | struct nilfs_snapshot_list cp_snapshot_list; | ||
462 | __le64 cp_cno; | ||
463 | __le64 cp_create; | ||
464 | __le64 cp_nblk_inc; | ||
465 | __le64 cp_inodes_count; | ||
466 | __le64 cp_blocks_count; /* Reserved (might be deleted) */ | ||
467 | |||
468 | /* Do not change the byte offset of ifile inode. | ||
469 | To keep the compatibility of the disk format, | ||
470 | additional fields should be added behind cp_ifile_inode. */ | ||
471 | struct nilfs_inode cp_ifile_inode; | ||
472 | }; | ||
473 | |||
474 | /* checkpoint flags */ | ||
475 | enum { | ||
476 | NILFS_CHECKPOINT_SNAPSHOT, | ||
477 | NILFS_CHECKPOINT_INVALID, | ||
478 | NILFS_CHECKPOINT_SKETCH, | ||
479 | NILFS_CHECKPOINT_MINOR, | ||
480 | }; | ||
481 | |||
482 | #define NILFS_CHECKPOINT_FNS(flag, name) \ | ||
483 | static inline void \ | ||
484 | nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ | ||
485 | { \ | ||
486 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ | ||
487 | (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
488 | } \ | ||
489 | static inline void \ | ||
490 | nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ | ||
491 | { \ | ||
492 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ | ||
493 | ~(1UL << NILFS_CHECKPOINT_##flag)); \ | ||
494 | } \ | ||
495 | static inline int \ | ||
496 | nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ | ||
497 | { \ | ||
498 | return !!(le32_to_cpu(cp->cp_flags) & \ | ||
499 | (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
500 | } | ||
501 | |||
502 | NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) | ||
503 | NILFS_CHECKPOINT_FNS(INVALID, invalid) | ||
504 | NILFS_CHECKPOINT_FNS(MINOR, minor) | ||
505 | |||
506 | /** | ||
507 | * struct nilfs_cpinfo - checkpoint information | ||
508 | * @ci_flags: flags | ||
509 | * @ci_pad: padding | ||
510 | * @ci_cno: checkpoint number | ||
511 | * @ci_create: creation timestamp | ||
512 | * @ci_nblk_inc: number of blocks incremented by this checkpoint | ||
513 | * @ci_inodes_count: inodes count | ||
514 | * @ci_blocks_count: blocks count | ||
515 | * @ci_next: next checkpoint number in snapshot list | ||
516 | */ | ||
517 | struct nilfs_cpinfo { | ||
518 | __u32 ci_flags; | ||
519 | __u32 ci_pad; | ||
520 | __u64 ci_cno; | ||
521 | __u64 ci_create; | ||
522 | __u64 ci_nblk_inc; | ||
523 | __u64 ci_inodes_count; | ||
524 | __u64 ci_blocks_count; | ||
525 | __u64 ci_next; | ||
526 | }; | ||
527 | |||
528 | #define NILFS_CPINFO_FNS(flag, name) \ | ||
529 | static inline int \ | ||
530 | nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \ | ||
531 | { \ | ||
532 | return !!(cpinfo->ci_flags & (1UL << NILFS_CHECKPOINT_##flag)); \ | ||
533 | } | ||
534 | |||
535 | NILFS_CPINFO_FNS(SNAPSHOT, snapshot) | ||
536 | NILFS_CPINFO_FNS(INVALID, invalid) | ||
537 | NILFS_CPINFO_FNS(MINOR, minor) | ||
538 | |||
539 | |||
540 | /** | ||
541 | * struct nilfs_cpfile_header - checkpoint file header | ||
542 | * @ch_ncheckpoints: number of checkpoints | ||
543 | * @ch_nsnapshots: number of snapshots | ||
544 | * @ch_snapshot_list: snapshot list | ||
545 | */ | ||
546 | struct nilfs_cpfile_header { | ||
547 | __le64 ch_ncheckpoints; | ||
548 | __le64 ch_nsnapshots; | ||
549 | struct nilfs_snapshot_list ch_snapshot_list; | ||
550 | }; | ||
551 | |||
552 | #define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \ | ||
553 | ((sizeof(struct nilfs_cpfile_header) + \ | ||
554 | sizeof(struct nilfs_checkpoint) - 1) / \ | ||
555 | sizeof(struct nilfs_checkpoint)) | ||
556 | |||
557 | /** | ||
558 | * struct nilfs_segment_usage - segment usage | ||
559 | * @su_lastmod: last modified timestamp | ||
560 | * @su_nblocks: number of blocks in segment | ||
561 | * @su_flags: flags | ||
562 | */ | ||
563 | struct nilfs_segment_usage { | ||
564 | __le64 su_lastmod; | ||
565 | __le32 su_nblocks; | ||
566 | __le32 su_flags; | ||
567 | }; | ||
568 | |||
569 | /* segment usage flag */ | ||
570 | enum { | ||
571 | NILFS_SEGMENT_USAGE_ACTIVE, | ||
572 | NILFS_SEGMENT_USAGE_DIRTY, | ||
573 | NILFS_SEGMENT_USAGE_ERROR, | ||
574 | |||
575 | /* ... */ | ||
576 | }; | ||
577 | |||
578 | #define NILFS_SEGMENT_USAGE_FNS(flag, name) \ | ||
579 | static inline void \ | ||
580 | nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ | ||
581 | { \ | ||
582 | su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ | ||
583 | (1UL << NILFS_SEGMENT_USAGE_##flag));\ | ||
584 | } \ | ||
585 | static inline void \ | ||
586 | nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ | ||
587 | { \ | ||
588 | su->su_flags = \ | ||
589 | cpu_to_le32(le32_to_cpu(su->su_flags) & \ | ||
590 | ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ | ||
591 | } \ | ||
592 | static inline int \ | ||
593 | nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ | ||
594 | { \ | ||
595 | return !!(le32_to_cpu(su->su_flags) & \ | ||
596 | (1UL << NILFS_SEGMENT_USAGE_##flag)); \ | ||
597 | } | ||
598 | |||
599 | NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) | ||
600 | NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty) | ||
601 | NILFS_SEGMENT_USAGE_FNS(ERROR, error) | ||
602 | |||
603 | static inline void | ||
604 | nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) | ||
605 | { | ||
606 | su->su_lastmod = cpu_to_le64(0); | ||
607 | su->su_nblocks = cpu_to_le32(0); | ||
608 | su->su_flags = cpu_to_le32(0); | ||
609 | } | ||
610 | |||
611 | static inline int | ||
612 | nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) | ||
613 | { | ||
614 | return !le32_to_cpu(su->su_flags); | ||
615 | } | ||
616 | |||
617 | /** | ||
618 | * struct nilfs_sufile_header - segment usage file header | ||
619 | * @sh_ncleansegs: number of clean segments | ||
620 | * @sh_ndirtysegs: number of dirty segments | ||
621 | * @sh_last_alloc: last allocated segment number | ||
622 | */ | ||
623 | struct nilfs_sufile_header { | ||
624 | __le64 sh_ncleansegs; | ||
625 | __le64 sh_ndirtysegs; | ||
626 | __le64 sh_last_alloc; | ||
627 | /* ... */ | ||
628 | }; | ||
629 | |||
630 | #define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \ | ||
631 | ((sizeof(struct nilfs_sufile_header) + \ | ||
632 | sizeof(struct nilfs_segment_usage) - 1) / \ | ||
633 | sizeof(struct nilfs_segment_usage)) | ||
634 | |||
635 | /** | ||
636 | * nilfs_suinfo - segment usage information | ||
637 | * @sui_lastmod: | ||
638 | * @sui_nblocks: | ||
639 | * @sui_flags: | ||
640 | */ | ||
641 | struct nilfs_suinfo { | ||
642 | __u64 sui_lastmod; | ||
643 | __u32 sui_nblocks; | ||
644 | __u32 sui_flags; | ||
645 | }; | ||
646 | |||
647 | #define NILFS_SUINFO_FNS(flag, name) \ | ||
648 | static inline int \ | ||
649 | nilfs_suinfo_##name(const struct nilfs_suinfo *si) \ | ||
650 | { \ | ||
651 | return si->sui_flags & (1UL << NILFS_SEGMENT_USAGE_##flag); \ | ||
652 | } | ||
653 | |||
654 | NILFS_SUINFO_FNS(ACTIVE, active) | ||
655 | NILFS_SUINFO_FNS(DIRTY, dirty) | ||
656 | NILFS_SUINFO_FNS(ERROR, error) | ||
657 | |||
658 | static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si) | ||
659 | { | ||
660 | return !si->sui_flags; | ||
661 | } | ||
662 | |||
663 | /* ioctl */ | ||
664 | enum { | ||
665 | NILFS_CHECKPOINT, | ||
666 | NILFS_SNAPSHOT, | ||
667 | }; | ||
668 | |||
669 | /** | ||
670 | * struct nilfs_cpmode - | ||
671 | * @cc_cno: | ||
672 | * @cc_mode: | ||
673 | */ | ||
674 | struct nilfs_cpmode { | ||
675 | __u64 cm_cno; | ||
676 | __u32 cm_mode; | ||
677 | __u32 cm_pad; | ||
678 | }; | ||
679 | |||
680 | /** | ||
681 | * struct nilfs_argv - argument vector | ||
682 | * @v_base: | ||
683 | * @v_nmembs: | ||
684 | * @v_size: | ||
685 | * @v_flags: | ||
686 | * @v_index: | ||
687 | */ | ||
688 | struct nilfs_argv { | ||
689 | __u64 v_base; | ||
690 | __u32 v_nmembs; /* number of members */ | ||
691 | __u16 v_size; /* size of members */ | ||
692 | __u16 v_flags; | ||
693 | __u64 v_index; | ||
694 | }; | ||
695 | |||
696 | /** | ||
697 | * struct nilfs_period - | ||
698 | * @p_start: | ||
699 | * @p_end: | ||
700 | */ | ||
701 | struct nilfs_period { | ||
702 | __u64 p_start; | ||
703 | __u64 p_end; | ||
704 | }; | ||
705 | |||
706 | /** | ||
707 | * struct nilfs_cpstat - | ||
708 | * @cs_cno: checkpoint number | ||
709 | * @cs_ncps: number of checkpoints | ||
710 | * @cs_nsss: number of snapshots | ||
711 | */ | ||
712 | struct nilfs_cpstat { | ||
713 | __u64 cs_cno; | ||
714 | __u64 cs_ncps; | ||
715 | __u64 cs_nsss; | ||
716 | }; | ||
717 | |||
718 | /** | ||
719 | * struct nilfs_sustat - | ||
720 | * @ss_nsegs: number of segments | ||
721 | * @ss_ncleansegs: number of clean segments | ||
722 | * @ss_ndirtysegs: number of dirty segments | ||
723 | * @ss_ctime: creation time of the last segment | ||
724 | * @ss_nongc_ctime: creation time of the last segment not for GC | ||
725 | * @ss_prot_seq: least sequence number of segments which must not be reclaimed | ||
726 | */ | ||
727 | struct nilfs_sustat { | ||
728 | __u64 ss_nsegs; | ||
729 | __u64 ss_ncleansegs; | ||
730 | __u64 ss_ndirtysegs; | ||
731 | __u64 ss_ctime; | ||
732 | __u64 ss_nongc_ctime; | ||
733 | __u64 ss_prot_seq; | ||
734 | }; | ||
735 | |||
736 | /** | ||
737 | * struct nilfs_vinfo - virtual block number information | ||
738 | * @vi_vblocknr: | ||
739 | * @vi_start: | ||
740 | * @vi_end: | ||
741 | * @vi_blocknr: | ||
742 | */ | ||
743 | struct nilfs_vinfo { | ||
744 | __u64 vi_vblocknr; | ||
745 | __u64 vi_start; | ||
746 | __u64 vi_end; | ||
747 | __u64 vi_blocknr; | ||
748 | }; | ||
749 | |||
750 | /** | ||
751 | * struct nilfs_vdesc - | ||
752 | */ | ||
753 | struct nilfs_vdesc { | ||
754 | __u64 vd_ino; | ||
755 | __u64 vd_cno; | ||
756 | __u64 vd_vblocknr; | ||
757 | struct nilfs_period vd_period; | ||
758 | __u64 vd_blocknr; | ||
759 | __u64 vd_offset; | ||
760 | __u32 vd_flags; | ||
761 | __u32 vd_pad; | ||
762 | }; | ||
763 | |||
764 | /** | ||
765 | * struct nilfs_bdesc - | ||
766 | */ | ||
767 | struct nilfs_bdesc { | ||
768 | __u64 bd_ino; | ||
769 | __u64 bd_oblocknr; | ||
770 | __u64 bd_blocknr; | ||
771 | __u64 bd_offset; | ||
772 | __u32 bd_level; | ||
773 | __u32 bd_pad; | ||
774 | }; | ||
775 | |||
776 | #define NILFS_IOCTL_IDENT 'n' | ||
777 | |||
778 | #define NILFS_IOCTL_CHANGE_CPMODE \ | ||
779 | _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode) | ||
780 | #define NILFS_IOCTL_DELETE_CHECKPOINT \ | ||
781 | _IOW(NILFS_IOCTL_IDENT, 0x81, __u64) | ||
782 | #define NILFS_IOCTL_GET_CPINFO \ | ||
783 | _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv) | ||
784 | #define NILFS_IOCTL_GET_CPSTAT \ | ||
785 | _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat) | ||
786 | #define NILFS_IOCTL_GET_SUINFO \ | ||
787 | _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv) | ||
788 | #define NILFS_IOCTL_GET_SUSTAT \ | ||
789 | _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat) | ||
790 | #define NILFS_IOCTL_GET_VINFO \ | ||
791 | _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv) | ||
792 | #define NILFS_IOCTL_GET_BDESCS \ | ||
793 | _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv) | ||
794 | #define NILFS_IOCTL_CLEAN_SEGMENTS \ | ||
795 | _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5]) | ||
796 | #define NILFS_IOCTL_SYNC \ | ||
797 | _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64) | ||
798 | #define NILFS_IOCTL_RESIZE \ | ||
799 | _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) | ||
800 | |||
801 | #endif /* _LINUX_NILFS_FS_H */ | ||
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index ea8c6d84996d..cc1767f5cca8 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h | |||
@@ -228,10 +228,11 @@ extern void parport_pc_release_resources(struct parport *p); | |||
228 | extern int parport_pc_claim_resources(struct parport *p); | 228 | extern int parport_pc_claim_resources(struct parport *p); |
229 | 229 | ||
230 | /* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ | 230 | /* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ |
231 | extern struct parport *parport_pc_probe_port (unsigned long base, | 231 | extern struct parport *parport_pc_probe_port(unsigned long base, |
232 | unsigned long base_hi, | 232 | unsigned long base_hi, |
233 | int irq, int dma, | 233 | int irq, int dma, |
234 | struct device *dev); | 234 | struct device *dev, |
235 | extern void parport_pc_unregister_port (struct parport *p); | 235 | int irqflags); |
236 | extern void parport_pc_unregister_port(struct parport *p); | ||
236 | 237 | ||
237 | #endif | 238 | #endif |
diff --git a/include/linux/pci.h b/include/linux/pci.h index a7fe4bbd7ff1..72698d89e767 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -674,6 +674,11 @@ int __must_check pci_reenable_device(struct pci_dev *); | |||
674 | int __must_check pcim_enable_device(struct pci_dev *pdev); | 674 | int __must_check pcim_enable_device(struct pci_dev *pdev); |
675 | void pcim_pin_device(struct pci_dev *pdev); | 675 | void pcim_pin_device(struct pci_dev *pdev); |
676 | 676 | ||
677 | static inline int pci_is_enabled(struct pci_dev *pdev) | ||
678 | { | ||
679 | return (atomic_read(&pdev->enable_cnt) > 0); | ||
680 | } | ||
681 | |||
677 | static inline int pci_is_managed(struct pci_dev *pdev) | 682 | static inline int pci_is_managed(struct pci_dev *pdev) |
678 | { | 683 | { |
679 | return pdev->is_managed; | 684 | return pdev->is_managed; |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 170f8b1f22db..ee98cd570885 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -944,6 +944,32 @@ | |||
944 | #define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 | 944 | #define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 |
945 | #define PCI_DEVICE_ID_SUN_CASSINI 0xabba | 945 | #define PCI_DEVICE_ID_SUN_CASSINI 0xabba |
946 | 946 | ||
947 | #define PCI_VENDOR_ID_NI 0x1093 | ||
948 | #define PCI_DEVICE_ID_NI_PCI2322 0xd130 | ||
949 | #define PCI_DEVICE_ID_NI_PCI2324 0xd140 | ||
950 | #define PCI_DEVICE_ID_NI_PCI2328 0xd150 | ||
951 | #define PCI_DEVICE_ID_NI_PXI8422_2322 0xd190 | ||
952 | #define PCI_DEVICE_ID_NI_PXI8422_2324 0xd1a0 | ||
953 | #define PCI_DEVICE_ID_NI_PXI8420_2322 0xd1d0 | ||
954 | #define PCI_DEVICE_ID_NI_PXI8420_2324 0xd1e0 | ||
955 | #define PCI_DEVICE_ID_NI_PXI8420_2328 0xd1f0 | ||
956 | #define PCI_DEVICE_ID_NI_PXI8420_23216 0xd1f1 | ||
957 | #define PCI_DEVICE_ID_NI_PCI2322I 0xd250 | ||
958 | #define PCI_DEVICE_ID_NI_PCI2324I 0xd270 | ||
959 | #define PCI_DEVICE_ID_NI_PCI23216 0xd2b0 | ||
960 | #define PCI_DEVICE_ID_NI_PXI8430_2322 0x7080 | ||
961 | #define PCI_DEVICE_ID_NI_PCI8430_2322 0x70db | ||
962 | #define PCI_DEVICE_ID_NI_PXI8430_2324 0x70dd | ||
963 | #define PCI_DEVICE_ID_NI_PCI8430_2324 0x70df | ||
964 | #define PCI_DEVICE_ID_NI_PXI8430_2328 0x70e2 | ||
965 | #define PCI_DEVICE_ID_NI_PCI8430_2328 0x70e4 | ||
966 | #define PCI_DEVICE_ID_NI_PXI8430_23216 0x70e6 | ||
967 | #define PCI_DEVICE_ID_NI_PCI8430_23216 0x70e7 | ||
968 | #define PCI_DEVICE_ID_NI_PXI8432_2322 0x70e8 | ||
969 | #define PCI_DEVICE_ID_NI_PCI8432_2322 0x70ea | ||
970 | #define PCI_DEVICE_ID_NI_PXI8432_2324 0x70ec | ||
971 | #define PCI_DEVICE_ID_NI_PCI8432_2324 0x70ee | ||
972 | |||
947 | #define PCI_VENDOR_ID_CMD 0x1095 | 973 | #define PCI_VENDOR_ID_CMD 0x1095 |
948 | #define PCI_DEVICE_ID_CMD_643 0x0643 | 974 | #define PCI_DEVICE_ID_CMD_643 0x0643 |
949 | #define PCI_DEVICE_ID_CMD_646 0x0646 | 975 | #define PCI_DEVICE_ID_CMD_646 0x0646 |
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index 80044a4f3ab9..bfd92e1e5d2c 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
39 | #include <linux/percpu.h> | ||
40 | #include <linux/cpumask.h> | 39 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 40 | #include <linux/seqlock.h> |
42 | 41 | ||
@@ -108,25 +107,14 @@ struct rcu_data { | |||
108 | struct rcu_head barrier; | 107 | struct rcu_head barrier; |
109 | }; | 108 | }; |
110 | 109 | ||
111 | DECLARE_PER_CPU(struct rcu_data, rcu_data); | ||
112 | DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); | ||
113 | |||
114 | /* | 110 | /* |
115 | * Increment the quiescent state counter. | 111 | * Increment the quiescent state counter. |
116 | * The counter is a bit degenerated: We do not need to know | 112 | * The counter is a bit degenerated: We do not need to know |
117 | * how many quiescent states passed, just if there was at least | 113 | * how many quiescent states passed, just if there was at least |
118 | * one since the start of the grace period. Thus just a flag. | 114 | * one since the start of the grace period. Thus just a flag. |
119 | */ | 115 | */ |
120 | static inline void rcu_qsctr_inc(int cpu) | 116 | extern void rcu_qsctr_inc(int cpu); |
121 | { | 117 | extern void rcu_bh_qsctr_inc(int cpu); |
122 | struct rcu_data *rdp = &per_cpu(rcu_data, cpu); | ||
123 | rdp->passed_quiesc = 1; | ||
124 | } | ||
125 | static inline void rcu_bh_qsctr_inc(int cpu) | ||
126 | { | ||
127 | struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu); | ||
128 | rdp->passed_quiesc = 1; | ||
129 | } | ||
130 | 118 | ||
131 | extern int rcu_pending(int cpu); | 119 | extern int rcu_pending(int cpu); |
132 | extern int rcu_needs_cpu(int cpu); | 120 | extern int rcu_needs_cpu(int cpu); |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 528343e6da51..15fbb3ca634d 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
39 | #include <linux/percpu.h> | ||
40 | #include <linux/cpumask.h> | 39 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 40 | #include <linux/seqlock.h> |
42 | #include <linux/lockdep.h> | 41 | #include <linux/lockdep.h> |
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index 74304b4538d8..fce522782ffa 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -36,34 +36,19 @@ | |||
36 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
39 | #include <linux/percpu.h> | 39 | #include <linux/smp.h> |
40 | #include <linux/cpumask.h> | 40 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | 42 | ||
43 | struct rcu_dyntick_sched { | 43 | extern void rcu_qsctr_inc(int cpu); |
44 | int dynticks; | 44 | static inline void rcu_bh_qsctr_inc(int cpu) { } |
45 | int dynticks_snap; | ||
46 | int sched_qs; | ||
47 | int sched_qs_snap; | ||
48 | int sched_dynticks_snap; | ||
49 | }; | ||
50 | |||
51 | DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched); | ||
52 | |||
53 | static inline void rcu_qsctr_inc(int cpu) | ||
54 | { | ||
55 | struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu); | ||
56 | |||
57 | rdssp->sched_qs++; | ||
58 | } | ||
59 | #define rcu_bh_qsctr_inc(cpu) | ||
60 | 45 | ||
61 | /* | 46 | /* |
62 | * Someone might want to pass call_rcu_bh as a function pointer. | 47 | * Someone might want to pass call_rcu_bh as a function pointer. |
63 | * So this needs to just be a rename and not a macro function. | 48 | * So this needs to just be a rename and not a macro function. |
64 | * (no parentheses) | 49 | * (no parentheses) |
65 | */ | 50 | */ |
66 | #define call_rcu_bh call_rcu | 51 | #define call_rcu_bh call_rcu |
67 | 52 | ||
68 | /** | 53 | /** |
69 | * call_rcu_sched - Queue RCU callback for invocation after sched grace period. | 54 | * call_rcu_sched - Queue RCU callback for invocation after sched grace period. |
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu); | |||
117 | struct softirq_action; | 102 | struct softirq_action; |
118 | 103 | ||
119 | #ifdef CONFIG_NO_HZ | 104 | #ifdef CONFIG_NO_HZ |
120 | 105 | extern void rcu_enter_nohz(void); | |
121 | static inline void rcu_enter_nohz(void) | 106 | extern void rcu_exit_nohz(void); |
122 | { | 107 | #else |
123 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | 108 | # define rcu_enter_nohz() do { } while (0) |
124 | 109 | # define rcu_exit_nohz() do { } while (0) | |
125 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ | 110 | #endif |
126 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | ||
127 | WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs); | ||
128 | } | ||
129 | |||
130 | static inline void rcu_exit_nohz(void) | ||
131 | { | ||
132 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
133 | |||
134 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | ||
135 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | ||
136 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), | ||
137 | &rs); | ||
138 | } | ||
139 | |||
140 | #else /* CONFIG_NO_HZ */ | ||
141 | #define rcu_enter_nohz() do { } while (0) | ||
142 | #define rcu_exit_nohz() do { } while (0) | ||
143 | #endif /* CONFIG_NO_HZ */ | ||
144 | 111 | ||
145 | /* | 112 | /* |
146 | * A context switch is a grace period for rcupreempt synchronize_rcu() | 113 | * A context switch is a grace period for rcupreempt synchronize_rcu() |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index a722fb67bb2d..0cdda00f2b2a 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/cache.h> | 33 | #include <linux/cache.h> |
34 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
35 | #include <linux/threads.h> | 35 | #include <linux/threads.h> |
36 | #include <linux/percpu.h> | ||
37 | #include <linux/cpumask.h> | 36 | #include <linux/cpumask.h> |
38 | #include <linux/seqlock.h> | 37 | #include <linux/seqlock.h> |
39 | 38 | ||
@@ -236,30 +235,8 @@ struct rcu_state { | |||
236 | #endif /* #ifdef CONFIG_NO_HZ */ | 235 | #endif /* #ifdef CONFIG_NO_HZ */ |
237 | }; | 236 | }; |
238 | 237 | ||
239 | extern struct rcu_state rcu_state; | 238 | extern void rcu_qsctr_inc(int cpu); |
240 | DECLARE_PER_CPU(struct rcu_data, rcu_data); | 239 | extern void rcu_bh_qsctr_inc(int cpu); |
241 | |||
242 | extern struct rcu_state rcu_bh_state; | ||
243 | DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); | ||
244 | |||
245 | /* | ||
246 | * Increment the quiescent state counter. | ||
247 | * The counter is a bit degenerated: We do not need to know | ||
248 | * how many quiescent states passed, just if there was at least | ||
249 | * one since the start of the grace period. Thus just a flag. | ||
250 | */ | ||
251 | static inline void rcu_qsctr_inc(int cpu) | ||
252 | { | ||
253 | struct rcu_data *rdp = &per_cpu(rcu_data, cpu); | ||
254 | rdp->passed_quiesc = 1; | ||
255 | rdp->passed_quiesc_completed = rdp->completed; | ||
256 | } | ||
257 | static inline void rcu_bh_qsctr_inc(int cpu) | ||
258 | { | ||
259 | struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu); | ||
260 | rdp->passed_quiesc = 1; | ||
261 | rdp->passed_quiesc_completed = rdp->completed; | ||
262 | } | ||
263 | 240 | ||
264 | extern int rcu_pending(int cpu); | 241 | extern int rcu_pending(int cpu); |
265 | extern int rcu_needs_cpu(int cpu); | 242 | extern int rcu_needs_cpu(int cpu); |
diff --git a/include/linux/security.h b/include/linux/security.h index 54ed15799a83..d5fd6163606f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/key.h> | 33 | #include <linux/key.h> |
34 | #include <linux/xfrm.h> | 34 | #include <linux/xfrm.h> |
35 | #include <linux/gfp.h> | ||
35 | #include <net/flow.h> | 36 | #include <net/flow.h> |
36 | 37 | ||
37 | /* Maximum number of letters for an LSM name string */ | 38 | /* Maximum number of letters for an LSM name string */ |
@@ -2953,5 +2954,28 @@ static inline void securityfs_remove(struct dentry *dentry) | |||
2953 | 2954 | ||
2954 | #endif | 2955 | #endif |
2955 | 2956 | ||
2957 | #ifdef CONFIG_SECURITY | ||
2958 | |||
2959 | static inline char *alloc_secdata(void) | ||
2960 | { | ||
2961 | return (char *)get_zeroed_page(GFP_KERNEL); | ||
2962 | } | ||
2963 | |||
2964 | static inline void free_secdata(void *secdata) | ||
2965 | { | ||
2966 | free_page((unsigned long)secdata); | ||
2967 | } | ||
2968 | |||
2969 | #else | ||
2970 | |||
2971 | static inline char *alloc_secdata(void) | ||
2972 | { | ||
2973 | return (char *)1; | ||
2974 | } | ||
2975 | |||
2976 | static inline void free_secdata(void *secdata) | ||
2977 | { } | ||
2978 | #endif /* CONFIG_SECURITY */ | ||
2979 | |||
2956 | #endif /* ! __LINUX_SECURITY_H */ | 2980 | #endif /* ! __LINUX_SECURITY_H */ |
2957 | 2981 | ||
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index df9245c7bd3b..57a97e52e58d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -164,6 +164,9 @@ | |||
164 | /* NWPSERIAL */ | 164 | /* NWPSERIAL */ |
165 | #define PORT_NWPSERIAL 85 | 165 | #define PORT_NWPSERIAL 85 |
166 | 166 | ||
167 | /* MAX3100 */ | ||
168 | #define PORT_MAX3100 86 | ||
169 | |||
167 | #ifdef __KERNEL__ | 170 | #ifdef __KERNEL__ |
168 | 171 | ||
169 | #include <linux/compiler.h> | 172 | #include <linux/compiler.h> |
@@ -277,7 +280,7 @@ struct uart_port { | |||
277 | struct uart_icount icount; /* statistics */ | 280 | struct uart_icount icount; /* statistics */ |
278 | 281 | ||
279 | struct console *cons; /* struct console, if any */ | 282 | struct console *cons; /* struct console, if any */ |
280 | #ifdef CONFIG_SERIAL_CORE_CONSOLE | 283 | #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ) |
281 | unsigned long sysrq; /* sysrq timeout */ | 284 | unsigned long sysrq; /* sysrq timeout */ |
282 | #endif | 285 | #endif |
283 | 286 | ||
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index f4523651fa42..5ac9b0bcaf9a 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -73,8 +73,8 @@ found: | |||
73 | 73 | ||
74 | ret = kmem_cache_alloc_notrace(cachep, flags); | 74 | ret = kmem_cache_alloc_notrace(cachep, flags); |
75 | 75 | ||
76 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | 76 | trace_kmalloc(_THIS_IP_, ret, |
77 | size, slab_buffer_size(cachep), flags); | 77 | size, slab_buffer_size(cachep), flags); |
78 | 78 | ||
79 | return ret; | 79 | return ret; |
80 | } | 80 | } |
@@ -128,9 +128,9 @@ found: | |||
128 | 128 | ||
129 | ret = kmem_cache_alloc_node_notrace(cachep, flags, node); | 129 | ret = kmem_cache_alloc_node_notrace(cachep, flags, node); |
130 | 130 | ||
131 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, | 131 | trace_kmalloc_node(_THIS_IP_, ret, |
132 | ret, size, slab_buffer_size(cachep), | 132 | size, slab_buffer_size(cachep), |
133 | flags, node); | 133 | flags, node); |
134 | 134 | ||
135 | return ret; | 135 | return ret; |
136 | } | 136 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index a1f90528e70b..5046f90c1171 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -233,8 +233,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
233 | unsigned int order = get_order(size); | 233 | unsigned int order = get_order(size); |
234 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); | 234 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); |
235 | 235 | ||
236 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | 236 | trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags); |
237 | size, PAGE_SIZE << order, flags); | ||
238 | 237 | ||
239 | return ret; | 238 | return ret; |
240 | } | 239 | } |
@@ -255,9 +254,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
255 | 254 | ||
256 | ret = kmem_cache_alloc_notrace(s, flags); | 255 | ret = kmem_cache_alloc_notrace(s, flags); |
257 | 256 | ||
258 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, | 257 | trace_kmalloc(_THIS_IP_, ret, size, s->size, flags); |
259 | _THIS_IP_, ret, | ||
260 | size, s->size, flags); | ||
261 | 258 | ||
262 | return ret; | 259 | return ret; |
263 | } | 260 | } |
@@ -296,9 +293,8 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
296 | 293 | ||
297 | ret = kmem_cache_alloc_node_notrace(s, flags, node); | 294 | ret = kmem_cache_alloc_node_notrace(s, flags, node); |
298 | 295 | ||
299 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, | 296 | trace_kmalloc_node(_THIS_IP_, ret, |
300 | _THIS_IP_, ret, | 297 | size, s->size, flags, node); |
301 | size, s->size, flags, node); | ||
302 | 298 | ||
303 | return ret; | 299 | return ret; |
304 | } | 300 | } |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 68bb1c501d0d..2cc43fa380cb 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -204,6 +204,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
204 | * SPI slaves, and are numbered from zero to num_chipselects. | 204 | * SPI slaves, and are numbered from zero to num_chipselects. |
205 | * each slave has a chipselect signal, but it's common that not | 205 | * each slave has a chipselect signal, but it's common that not |
206 | * every chipselect is connected to a slave. | 206 | * every chipselect is connected to a slave. |
207 | * @dma_alignment: SPI controller constraint on DMA buffers alignment. | ||
207 | * @setup: updates the device mode and clocking records used by a | 208 | * @setup: updates the device mode and clocking records used by a |
208 | * device's SPI controller; protocol code may call this. This | 209 | * device's SPI controller; protocol code may call this. This |
209 | * must fail if an unrecognized or unsupported mode is requested. | 210 | * must fail if an unrecognized or unsupported mode is requested. |
@@ -239,6 +240,11 @@ struct spi_master { | |||
239 | */ | 240 | */ |
240 | u16 num_chipselect; | 241 | u16 num_chipselect; |
241 | 242 | ||
243 | /* some SPI controllers pose alignment requirements on DMAable | ||
244 | * buffers; let protocol drivers know about these requirements. | ||
245 | */ | ||
246 | u16 dma_alignment; | ||
247 | |||
242 | /* setup mode and clock, etc (spi driver may call many times) */ | 248 | /* setup mode and clock, etc (spi driver may call many times) */ |
243 | int (*setup)(struct spi_device *spi); | 249 | int (*setup)(struct spi_device *spi); |
244 | 250 | ||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index d3a4c0231933..2a30775959e9 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -24,6 +24,15 @@ | |||
24 | */ | 24 | */ |
25 | typedef int (*svc_thread_fn)(void *); | 25 | typedef int (*svc_thread_fn)(void *); |
26 | 26 | ||
27 | /* statistics for svc_pool structures */ | ||
28 | struct svc_pool_stats { | ||
29 | unsigned long packets; | ||
30 | unsigned long sockets_queued; | ||
31 | unsigned long threads_woken; | ||
32 | unsigned long overloads_avoided; | ||
33 | unsigned long threads_timedout; | ||
34 | }; | ||
35 | |||
27 | /* | 36 | /* |
28 | * | 37 | * |
29 | * RPC service thread pool. | 38 | * RPC service thread pool. |
@@ -41,6 +50,8 @@ struct svc_pool { | |||
41 | struct list_head sp_sockets; /* pending sockets */ | 50 | struct list_head sp_sockets; /* pending sockets */ |
42 | unsigned int sp_nrthreads; /* # of threads in pool */ | 51 | unsigned int sp_nrthreads; /* # of threads in pool */ |
43 | struct list_head sp_all_threads; /* all server threads */ | 52 | struct list_head sp_all_threads; /* all server threads */ |
53 | int sp_nwaking; /* number of threads woken but not yet active */ | ||
54 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ | ||
44 | } ____cacheline_aligned_in_smp; | 55 | } ____cacheline_aligned_in_smp; |
45 | 56 | ||
46 | /* | 57 | /* |
@@ -83,6 +94,8 @@ struct svc_serv { | |||
83 | struct module * sv_module; /* optional module to count when | 94 | struct module * sv_module; /* optional module to count when |
84 | * adding threads */ | 95 | * adding threads */ |
85 | svc_thread_fn sv_function; /* main function for threads */ | 96 | svc_thread_fn sv_function; /* main function for threads */ |
97 | unsigned int sv_drc_max_pages; /* Total pages for DRC */ | ||
98 | unsigned int sv_drc_pages_used;/* DRC pages used */ | ||
86 | }; | 99 | }; |
87 | 100 | ||
88 | /* | 101 | /* |
@@ -218,6 +231,7 @@ struct svc_rqst { | |||
218 | struct svc_cred rq_cred; /* auth info */ | 231 | struct svc_cred rq_cred; /* auth info */ |
219 | void * rq_xprt_ctxt; /* transport specific context ptr */ | 232 | void * rq_xprt_ctxt; /* transport specific context ptr */ |
220 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ | 233 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ |
234 | int rq_usedeferral; /* use deferral */ | ||
221 | 235 | ||
222 | size_t rq_xprt_hlen; /* xprt header len */ | 236 | size_t rq_xprt_hlen; /* xprt header len */ |
223 | struct xdr_buf rq_arg; | 237 | struct xdr_buf rq_arg; |
@@ -263,6 +277,7 @@ struct svc_rqst { | |||
263 | * cache pages */ | 277 | * cache pages */ |
264 | wait_queue_head_t rq_wait; /* synchronization */ | 278 | wait_queue_head_t rq_wait; /* synchronization */ |
265 | struct task_struct *rq_task; /* service thread */ | 279 | struct task_struct *rq_task; /* service thread */ |
280 | int rq_waking; /* 1 if thread is being woken */ | ||
266 | }; | 281 | }; |
267 | 282 | ||
268 | /* | 283 | /* |
@@ -393,6 +408,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | |||
393 | void (*shutdown)(struct svc_serv *), | 408 | void (*shutdown)(struct svc_serv *), |
394 | svc_thread_fn, struct module *); | 409 | svc_thread_fn, struct module *); |
395 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 410 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
411 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); | ||
396 | void svc_destroy(struct svc_serv *); | 412 | void svc_destroy(struct svc_serv *); |
397 | int svc_process(struct svc_rqst *); | 413 | int svc_process(struct svc_rqst *); |
398 | int svc_register(const struct svc_serv *, const int, | 414 | int svc_register(const struct svc_serv *, const int, |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 49e1eb454465..d8910b68e1bd 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -69,27 +69,27 @@ struct xdr_buf { | |||
69 | * pre-xdr'ed macros. | 69 | * pre-xdr'ed macros. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | #define xdr_zero __constant_htonl(0) | 72 | #define xdr_zero cpu_to_be32(0) |
73 | #define xdr_one __constant_htonl(1) | 73 | #define xdr_one cpu_to_be32(1) |
74 | #define xdr_two __constant_htonl(2) | 74 | #define xdr_two cpu_to_be32(2) |
75 | 75 | ||
76 | #define rpc_success __constant_htonl(RPC_SUCCESS) | 76 | #define rpc_success cpu_to_be32(RPC_SUCCESS) |
77 | #define rpc_prog_unavail __constant_htonl(RPC_PROG_UNAVAIL) | 77 | #define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL) |
78 | #define rpc_prog_mismatch __constant_htonl(RPC_PROG_MISMATCH) | 78 | #define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH) |
79 | #define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) | 79 | #define rpc_proc_unavail cpu_to_be32(RPC_PROC_UNAVAIL) |
80 | #define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) | 80 | #define rpc_garbage_args cpu_to_be32(RPC_GARBAGE_ARGS) |
81 | #define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) | 81 | #define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR) |
82 | #define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY) | 82 | #define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY) |
83 | 83 | ||
84 | #define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) | 84 | #define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK) |
85 | #define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) | 85 | #define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED) |
86 | #define rpc_autherr_rejectedcred __constant_htonl(RPC_AUTH_REJECTEDCRED) | 86 | #define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED) |
87 | #define rpc_autherr_badverf __constant_htonl(RPC_AUTH_BADVERF) | 87 | #define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF) |
88 | #define rpc_autherr_rejectedverf __constant_htonl(RPC_AUTH_REJECTEDVERF) | 88 | #define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF) |
89 | #define rpc_autherr_tooweak __constant_htonl(RPC_AUTH_TOOWEAK) | 89 | #define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK) |
90 | #define rpcsec_gsserr_credproblem __constant_htonl(RPCSEC_GSS_CREDPROBLEM) | 90 | #define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM) |
91 | #define rpcsec_gsserr_ctxproblem __constant_htonl(RPCSEC_GSS_CTXPROBLEM) | 91 | #define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM) |
92 | #define rpc_autherr_oldseqnum __constant_htonl(101) | 92 | #define rpc_autherr_oldseqnum cpu_to_be32(101) |
93 | 93 | ||
94 | /* | 94 | /* |
95 | * Miscellaneous XDR helper functions | 95 | * Miscellaneous XDR helper functions |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 8615d661ab60..bcba84ea2d86 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -309,7 +309,8 @@ extern void tty_set_operations(struct tty_driver *driver, | |||
309 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | 309 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); |
310 | 310 | ||
311 | extern void tty_driver_kref_put(struct tty_driver *driver); | 311 | extern void tty_driver_kref_put(struct tty_driver *driver); |
312 | extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | 312 | |
313 | static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | ||
313 | { | 314 | { |
314 | kref_get(&d->kref); | 315 | kref_get(&d->kref); |
315 | return d; | 316 | return d; |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 139d234923cd..ebb2ea6b4995 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -737,6 +737,11 @@ struct v4l2_input { | |||
737 | #define V4L2_IN_ST_NO_SIGNAL 0x00000002 | 737 | #define V4L2_IN_ST_NO_SIGNAL 0x00000002 |
738 | #define V4L2_IN_ST_NO_COLOR 0x00000004 | 738 | #define V4L2_IN_ST_NO_COLOR 0x00000004 |
739 | 739 | ||
740 | /* field 'status' - sensor orientation */ | ||
741 | /* If sensor is mounted upside down set both bits */ | ||
742 | #define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ | ||
743 | #define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ | ||
744 | |||
740 | /* field 'status' - analog */ | 745 | /* field 'status' - analog */ |
741 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ | 746 | #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ |
742 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ | 747 | #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 93445477f86a..9c1ed1fb6ddb 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -168,6 +168,8 @@ void writeback_set_ratelimit(void); | |||
168 | /* pdflush.c */ | 168 | /* pdflush.c */ |
169 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl | 169 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
170 | read-only. */ | 170 | read-only. */ |
171 | extern int nr_pdflush_threads_max; /* Global so it can be exported to sysctl */ | ||
172 | extern int nr_pdflush_threads_min; /* Global so it can be exported to sysctl */ | ||
171 | 173 | ||
172 | 174 | ||
173 | #endif /* WRITEBACK_H */ | 175 | #endif /* WRITEBACK_H */ |