diff options
Diffstat (limited to 'include')
44 files changed, 1066 insertions, 225 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 010545436efa..1ffb53f74d37 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -22,11 +22,9 @@ struct seq_file; | |||
22 | 22 | ||
23 | struct crypto_type { | 23 | struct crypto_type { |
24 | unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); | 24 | unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); |
25 | unsigned int (*extsize)(struct crypto_alg *alg, | 25 | unsigned int (*extsize)(struct crypto_alg *alg); |
26 | const struct crypto_type *frontend); | ||
27 | int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); | 26 | int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); |
28 | int (*init_tfm)(struct crypto_tfm *tfm, | 27 | int (*init_tfm)(struct crypto_tfm *tfm); |
29 | const struct crypto_type *frontend); | ||
30 | void (*show)(struct seq_file *m, struct crypto_alg *alg); | 28 | void (*show)(struct seq_file *m, struct crypto_alg *alg); |
31 | struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask); | 29 | struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask); |
32 | 30 | ||
@@ -52,6 +50,7 @@ struct crypto_template { | |||
52 | 50 | ||
53 | struct crypto_instance *(*alloc)(struct rtattr **tb); | 51 | struct crypto_instance *(*alloc)(struct rtattr **tb); |
54 | void (*free)(struct crypto_instance *inst); | 52 | void (*free)(struct crypto_instance *inst); |
53 | int (*create)(struct crypto_template *tmpl, struct rtattr **tb); | ||
55 | 54 | ||
56 | char name[CRYPTO_MAX_ALG_NAME]; | 55 | char name[CRYPTO_MAX_ALG_NAME]; |
57 | }; | 56 | }; |
@@ -60,6 +59,7 @@ struct crypto_spawn { | |||
60 | struct list_head list; | 59 | struct list_head list; |
61 | struct crypto_alg *alg; | 60 | struct crypto_alg *alg; |
62 | struct crypto_instance *inst; | 61 | struct crypto_instance *inst; |
62 | const struct crypto_type *frontend; | ||
63 | u32 mask; | 63 | u32 mask; |
64 | }; | 64 | }; |
65 | 65 | ||
@@ -114,11 +114,19 @@ int crypto_register_template(struct crypto_template *tmpl); | |||
114 | void crypto_unregister_template(struct crypto_template *tmpl); | 114 | void crypto_unregister_template(struct crypto_template *tmpl); |
115 | struct crypto_template *crypto_lookup_template(const char *name); | 115 | struct crypto_template *crypto_lookup_template(const char *name); |
116 | 116 | ||
117 | int crypto_register_instance(struct crypto_template *tmpl, | ||
118 | struct crypto_instance *inst); | ||
119 | |||
117 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | 120 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, |
118 | struct crypto_instance *inst, u32 mask); | 121 | struct crypto_instance *inst, u32 mask); |
122 | int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg, | ||
123 | struct crypto_instance *inst, | ||
124 | const struct crypto_type *frontend); | ||
125 | |||
119 | void crypto_drop_spawn(struct crypto_spawn *spawn); | 126 | void crypto_drop_spawn(struct crypto_spawn *spawn); |
120 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, | 127 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, |
121 | u32 mask); | 128 | u32 mask); |
129 | void *crypto_spawn_tfm2(struct crypto_spawn *spawn); | ||
122 | 130 | ||
123 | static inline void crypto_set_spawn(struct crypto_spawn *spawn, | 131 | static inline void crypto_set_spawn(struct crypto_spawn *spawn, |
124 | struct crypto_instance *inst) | 132 | struct crypto_instance *inst) |
@@ -129,14 +137,26 @@ static inline void crypto_set_spawn(struct crypto_spawn *spawn, | |||
129 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); | 137 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); |
130 | int crypto_check_attr_type(struct rtattr **tb, u32 type); | 138 | int crypto_check_attr_type(struct rtattr **tb, u32 type); |
131 | const char *crypto_attr_alg_name(struct rtattr *rta); | 139 | const char *crypto_attr_alg_name(struct rtattr *rta); |
132 | struct crypto_alg *crypto_attr_alg(struct rtattr *rta, u32 type, u32 mask); | 140 | struct crypto_alg *crypto_attr_alg2(struct rtattr *rta, |
141 | const struct crypto_type *frontend, | ||
142 | u32 type, u32 mask); | ||
143 | |||
144 | static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta, | ||
145 | u32 type, u32 mask) | ||
146 | { | ||
147 | return crypto_attr_alg2(rta, NULL, type, mask); | ||
148 | } | ||
149 | |||
133 | int crypto_attr_u32(struct rtattr *rta, u32 *num); | 150 | int crypto_attr_u32(struct rtattr *rta, u32 *num); |
151 | void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg, | ||
152 | unsigned int head); | ||
134 | struct crypto_instance *crypto_alloc_instance(const char *name, | 153 | struct crypto_instance *crypto_alloc_instance(const char *name, |
135 | struct crypto_alg *alg); | 154 | struct crypto_alg *alg); |
136 | 155 | ||
137 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); | 156 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); |
138 | int crypto_enqueue_request(struct crypto_queue *queue, | 157 | int crypto_enqueue_request(struct crypto_queue *queue, |
139 | struct crypto_async_request *request); | 158 | struct crypto_async_request *request); |
159 | void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset); | ||
140 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); | 160 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); |
141 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); | 161 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); |
142 | 162 | ||
@@ -156,12 +176,8 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc, | |||
156 | 176 | ||
157 | static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) | 177 | static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) |
158 | { | 178 | { |
159 | unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm); | 179 | return PTR_ALIGN(crypto_tfm_ctx(tfm), |
160 | unsigned long align = crypto_tfm_alg_alignmask(tfm); | 180 | crypto_tfm_alg_alignmask(tfm) + 1); |
161 | |||
162 | if (align <= crypto_tfm_ctx_alignment()) | ||
163 | align = 1; | ||
164 | return (void *)ALIGN(addr, align); | ||
165 | } | 181 | } |
166 | 182 | ||
167 | static inline struct crypto_instance *crypto_tfm_alg_instance( | 183 | static inline struct crypto_instance *crypto_tfm_alg_instance( |
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h index 55fa7bbdbc71..2f65a6e8ea4d 100644 --- a/include/crypto/cryptd.h +++ b/include/crypto/cryptd.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/crypto.h> | 8 | #include <linux/crypto.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <crypto/hash.h> | ||
10 | 11 | ||
11 | struct cryptd_ablkcipher { | 12 | struct cryptd_ablkcipher { |
12 | struct crypto_ablkcipher base; | 13 | struct crypto_ablkcipher base; |
@@ -24,4 +25,20 @@ struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name, | |||
24 | struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm); | 25 | struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm); |
25 | void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm); | 26 | void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm); |
26 | 27 | ||
28 | struct cryptd_ahash { | ||
29 | struct crypto_ahash base; | ||
30 | }; | ||
31 | |||
32 | static inline struct cryptd_ahash *__cryptd_ahash_cast( | ||
33 | struct crypto_ahash *tfm) | ||
34 | { | ||
35 | return (struct cryptd_ahash *)tfm; | ||
36 | } | ||
37 | |||
38 | /* alg_name should be algorithm to be cryptd-ed */ | ||
39 | struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, | ||
40 | u32 type, u32 mask); | ||
41 | struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); | ||
42 | void cryptd_free_ahash(struct cryptd_ahash *tfm); | ||
43 | |||
27 | #endif | 44 | #endif |
diff --git a/include/crypto/hash.h b/include/crypto/hash.h index d56bb71617c3..26cb1eb16f4c 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h | |||
@@ -15,6 +15,42 @@ | |||
15 | 15 | ||
16 | #include <linux/crypto.h> | 16 | #include <linux/crypto.h> |
17 | 17 | ||
18 | struct crypto_ahash; | ||
19 | |||
20 | struct hash_alg_common { | ||
21 | unsigned int digestsize; | ||
22 | unsigned int statesize; | ||
23 | |||
24 | struct crypto_alg base; | ||
25 | }; | ||
26 | |||
27 | struct ahash_request { | ||
28 | struct crypto_async_request base; | ||
29 | |||
30 | unsigned int nbytes; | ||
31 | struct scatterlist *src; | ||
32 | u8 *result; | ||
33 | |||
34 | /* This field may only be used by the ahash API code. */ | ||
35 | void *priv; | ||
36 | |||
37 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
38 | }; | ||
39 | |||
40 | struct ahash_alg { | ||
41 | int (*init)(struct ahash_request *req); | ||
42 | int (*update)(struct ahash_request *req); | ||
43 | int (*final)(struct ahash_request *req); | ||
44 | int (*finup)(struct ahash_request *req); | ||
45 | int (*digest)(struct ahash_request *req); | ||
46 | int (*export)(struct ahash_request *req, void *out); | ||
47 | int (*import)(struct ahash_request *req, const void *in); | ||
48 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
49 | unsigned int keylen); | ||
50 | |||
51 | struct hash_alg_common halg; | ||
52 | }; | ||
53 | |||
18 | struct shash_desc { | 54 | struct shash_desc { |
19 | struct crypto_shash *tfm; | 55 | struct crypto_shash *tfm; |
20 | u32 flags; | 56 | u32 flags; |
@@ -24,7 +60,6 @@ struct shash_desc { | |||
24 | 60 | ||
25 | struct shash_alg { | 61 | struct shash_alg { |
26 | int (*init)(struct shash_desc *desc); | 62 | int (*init)(struct shash_desc *desc); |
27 | int (*reinit)(struct shash_desc *desc); | ||
28 | int (*update)(struct shash_desc *desc, const u8 *data, | 63 | int (*update)(struct shash_desc *desc, const u8 *data, |
29 | unsigned int len); | 64 | unsigned int len); |
30 | int (*final)(struct shash_desc *desc, u8 *out); | 65 | int (*final)(struct shash_desc *desc, u8 *out); |
@@ -32,38 +67,48 @@ struct shash_alg { | |||
32 | unsigned int len, u8 *out); | 67 | unsigned int len, u8 *out); |
33 | int (*digest)(struct shash_desc *desc, const u8 *data, | 68 | int (*digest)(struct shash_desc *desc, const u8 *data, |
34 | unsigned int len, u8 *out); | 69 | unsigned int len, u8 *out); |
70 | int (*export)(struct shash_desc *desc, void *out); | ||
71 | int (*import)(struct shash_desc *desc, const void *in); | ||
35 | int (*setkey)(struct crypto_shash *tfm, const u8 *key, | 72 | int (*setkey)(struct crypto_shash *tfm, const u8 *key, |
36 | unsigned int keylen); | 73 | unsigned int keylen); |
37 | 74 | ||
38 | unsigned int descsize; | 75 | unsigned int descsize; |
39 | unsigned int digestsize; | 76 | |
77 | /* These fields must match hash_alg_common. */ | ||
78 | unsigned int digestsize | ||
79 | __attribute__ ((aligned(__alignof__(struct hash_alg_common)))); | ||
80 | unsigned int statesize; | ||
40 | 81 | ||
41 | struct crypto_alg base; | 82 | struct crypto_alg base; |
42 | }; | 83 | }; |
43 | 84 | ||
44 | struct crypto_ahash { | 85 | struct crypto_ahash { |
86 | int (*init)(struct ahash_request *req); | ||
87 | int (*update)(struct ahash_request *req); | ||
88 | int (*final)(struct ahash_request *req); | ||
89 | int (*finup)(struct ahash_request *req); | ||
90 | int (*digest)(struct ahash_request *req); | ||
91 | int (*export)(struct ahash_request *req, void *out); | ||
92 | int (*import)(struct ahash_request *req, const void *in); | ||
93 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
94 | unsigned int keylen); | ||
95 | |||
96 | unsigned int reqsize; | ||
45 | struct crypto_tfm base; | 97 | struct crypto_tfm base; |
46 | }; | 98 | }; |
47 | 99 | ||
48 | struct crypto_shash { | 100 | struct crypto_shash { |
101 | unsigned int descsize; | ||
49 | struct crypto_tfm base; | 102 | struct crypto_tfm base; |
50 | }; | 103 | }; |
51 | 104 | ||
52 | static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) | 105 | static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) |
53 | { | 106 | { |
54 | return (struct crypto_ahash *)tfm; | 107 | return container_of(tfm, struct crypto_ahash, base); |
55 | } | 108 | } |
56 | 109 | ||
57 | static inline struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, | 110 | struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type, |
58 | u32 type, u32 mask) | 111 | u32 mask); |
59 | { | ||
60 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
61 | mask &= ~CRYPTO_ALG_TYPE_MASK; | ||
62 | type |= CRYPTO_ALG_TYPE_AHASH; | ||
63 | mask |= CRYPTO_ALG_TYPE_AHASH_MASK; | ||
64 | |||
65 | return __crypto_ahash_cast(crypto_alloc_base(alg_name, type, mask)); | ||
66 | } | ||
67 | 112 | ||
68 | static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) | 113 | static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) |
69 | { | 114 | { |
@@ -72,7 +117,7 @@ static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) | |||
72 | 117 | ||
73 | static inline void crypto_free_ahash(struct crypto_ahash *tfm) | 118 | static inline void crypto_free_ahash(struct crypto_ahash *tfm) |
74 | { | 119 | { |
75 | crypto_free_tfm(crypto_ahash_tfm(tfm)); | 120 | crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm)); |
76 | } | 121 | } |
77 | 122 | ||
78 | static inline unsigned int crypto_ahash_alignmask( | 123 | static inline unsigned int crypto_ahash_alignmask( |
@@ -81,14 +126,26 @@ static inline unsigned int crypto_ahash_alignmask( | |||
81 | return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm)); | 126 | return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm)); |
82 | } | 127 | } |
83 | 128 | ||
84 | static inline struct ahash_tfm *crypto_ahash_crt(struct crypto_ahash *tfm) | 129 | static inline struct hash_alg_common *__crypto_hash_alg_common( |
130 | struct crypto_alg *alg) | ||
131 | { | ||
132 | return container_of(alg, struct hash_alg_common, base); | ||
133 | } | ||
134 | |||
135 | static inline struct hash_alg_common *crypto_hash_alg_common( | ||
136 | struct crypto_ahash *tfm) | ||
85 | { | 137 | { |
86 | return &crypto_ahash_tfm(tfm)->crt_ahash; | 138 | return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg); |
87 | } | 139 | } |
88 | 140 | ||
89 | static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) | 141 | static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) |
90 | { | 142 | { |
91 | return crypto_ahash_crt(tfm)->digestsize; | 143 | return crypto_hash_alg_common(tfm)->digestsize; |
144 | } | ||
145 | |||
146 | static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm) | ||
147 | { | ||
148 | return crypto_hash_alg_common(tfm)->statesize; | ||
92 | } | 149 | } |
93 | 150 | ||
94 | static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm) | 151 | static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm) |
@@ -114,7 +171,7 @@ static inline struct crypto_ahash *crypto_ahash_reqtfm( | |||
114 | 171 | ||
115 | static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) | 172 | static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) |
116 | { | 173 | { |
117 | return crypto_ahash_crt(tfm)->reqsize; | 174 | return tfm->reqsize; |
118 | } | 175 | } |
119 | 176 | ||
120 | static inline void *ahash_request_ctx(struct ahash_request *req) | 177 | static inline void *ahash_request_ctx(struct ahash_request *req) |
@@ -122,44 +179,30 @@ static inline void *ahash_request_ctx(struct ahash_request *req) | |||
122 | return req->__ctx; | 179 | return req->__ctx; |
123 | } | 180 | } |
124 | 181 | ||
125 | static inline int crypto_ahash_setkey(struct crypto_ahash *tfm, | 182 | int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, |
126 | const u8 *key, unsigned int keylen) | 183 | unsigned int keylen); |
127 | { | 184 | int crypto_ahash_finup(struct ahash_request *req); |
128 | struct ahash_tfm *crt = crypto_ahash_crt(tfm); | 185 | int crypto_ahash_final(struct ahash_request *req); |
129 | 186 | int crypto_ahash_digest(struct ahash_request *req); | |
130 | return crt->setkey(tfm, key, keylen); | ||
131 | } | ||
132 | 187 | ||
133 | static inline int crypto_ahash_digest(struct ahash_request *req) | 188 | static inline int crypto_ahash_export(struct ahash_request *req, void *out) |
134 | { | 189 | { |
135 | struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); | 190 | return crypto_ahash_reqtfm(req)->export(req, out); |
136 | return crt->digest(req); | ||
137 | } | 191 | } |
138 | 192 | ||
139 | static inline void crypto_ahash_export(struct ahash_request *req, u8 *out) | 193 | static inline int crypto_ahash_import(struct ahash_request *req, const void *in) |
140 | { | 194 | { |
141 | memcpy(out, ahash_request_ctx(req), | 195 | return crypto_ahash_reqtfm(req)->import(req, in); |
142 | crypto_ahash_reqsize(crypto_ahash_reqtfm(req))); | ||
143 | } | 196 | } |
144 | 197 | ||
145 | int crypto_ahash_import(struct ahash_request *req, const u8 *in); | ||
146 | |||
147 | static inline int crypto_ahash_init(struct ahash_request *req) | 198 | static inline int crypto_ahash_init(struct ahash_request *req) |
148 | { | 199 | { |
149 | struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); | 200 | return crypto_ahash_reqtfm(req)->init(req); |
150 | return crt->init(req); | ||
151 | } | 201 | } |
152 | 202 | ||
153 | static inline int crypto_ahash_update(struct ahash_request *req) | 203 | static inline int crypto_ahash_update(struct ahash_request *req) |
154 | { | 204 | { |
155 | struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); | 205 | return crypto_ahash_reqtfm(req)->update(req); |
156 | return crt->update(req); | ||
157 | } | ||
158 | |||
159 | static inline int crypto_ahash_final(struct ahash_request *req) | ||
160 | { | ||
161 | struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); | ||
162 | return crt->final(req); | ||
163 | } | 206 | } |
164 | 207 | ||
165 | static inline void ahash_request_set_tfm(struct ahash_request *req, | 208 | static inline void ahash_request_set_tfm(struct ahash_request *req, |
@@ -184,7 +227,7 @@ static inline struct ahash_request *ahash_request_alloc( | |||
184 | 227 | ||
185 | static inline void ahash_request_free(struct ahash_request *req) | 228 | static inline void ahash_request_free(struct ahash_request *req) |
186 | { | 229 | { |
187 | kfree(req); | 230 | kzfree(req); |
188 | } | 231 | } |
189 | 232 | ||
190 | static inline struct ahash_request *ahash_request_cast( | 233 | static inline struct ahash_request *ahash_request_cast( |
@@ -251,6 +294,11 @@ static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm) | |||
251 | return crypto_shash_alg(tfm)->digestsize; | 294 | return crypto_shash_alg(tfm)->digestsize; |
252 | } | 295 | } |
253 | 296 | ||
297 | static inline unsigned int crypto_shash_statesize(struct crypto_shash *tfm) | ||
298 | { | ||
299 | return crypto_shash_alg(tfm)->statesize; | ||
300 | } | ||
301 | |||
254 | static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm) | 302 | static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm) |
255 | { | 303 | { |
256 | return crypto_tfm_get_flags(crypto_shash_tfm(tfm)); | 304 | return crypto_tfm_get_flags(crypto_shash_tfm(tfm)); |
@@ -268,7 +316,7 @@ static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags) | |||
268 | 316 | ||
269 | static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) | 317 | static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) |
270 | { | 318 | { |
271 | return crypto_shash_alg(tfm)->descsize; | 319 | return tfm->descsize; |
272 | } | 320 | } |
273 | 321 | ||
274 | static inline void *shash_desc_ctx(struct shash_desc *desc) | 322 | static inline void *shash_desc_ctx(struct shash_desc *desc) |
@@ -281,12 +329,15 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, | |||
281 | int crypto_shash_digest(struct shash_desc *desc, const u8 *data, | 329 | int crypto_shash_digest(struct shash_desc *desc, const u8 *data, |
282 | unsigned int len, u8 *out); | 330 | unsigned int len, u8 *out); |
283 | 331 | ||
284 | static inline void crypto_shash_export(struct shash_desc *desc, u8 *out) | 332 | static inline int crypto_shash_export(struct shash_desc *desc, void *out) |
285 | { | 333 | { |
286 | memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm)); | 334 | return crypto_shash_alg(desc->tfm)->export(desc, out); |
287 | } | 335 | } |
288 | 336 | ||
289 | int crypto_shash_import(struct shash_desc *desc, const u8 *in); | 337 | static inline int crypto_shash_import(struct shash_desc *desc, const void *in) |
338 | { | ||
339 | return crypto_shash_alg(desc->tfm)->import(desc, in); | ||
340 | } | ||
290 | 341 | ||
291 | static inline int crypto_shash_init(struct shash_desc *desc) | 342 | static inline int crypto_shash_init(struct shash_desc *desc) |
292 | { | 343 | { |
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index 82b70564bcab..5bfad8c80595 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h | |||
@@ -34,6 +34,22 @@ struct crypto_hash_walk { | |||
34 | unsigned int flags; | 34 | unsigned int flags; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct ahash_instance { | ||
38 | struct ahash_alg alg; | ||
39 | }; | ||
40 | |||
41 | struct shash_instance { | ||
42 | struct shash_alg alg; | ||
43 | }; | ||
44 | |||
45 | struct crypto_ahash_spawn { | ||
46 | struct crypto_spawn base; | ||
47 | }; | ||
48 | |||
49 | struct crypto_shash_spawn { | ||
50 | struct crypto_spawn base; | ||
51 | }; | ||
52 | |||
37 | extern const struct crypto_type crypto_ahash_type; | 53 | extern const struct crypto_type crypto_ahash_type; |
38 | 54 | ||
39 | int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); | 55 | int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); |
@@ -43,18 +59,100 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc, | |||
43 | struct crypto_hash_walk *walk, | 59 | struct crypto_hash_walk *walk, |
44 | struct scatterlist *sg, unsigned int len); | 60 | struct scatterlist *sg, unsigned int len); |
45 | 61 | ||
62 | static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk) | ||
63 | { | ||
64 | return !(walk->entrylen | walk->total); | ||
65 | } | ||
66 | |||
67 | int crypto_register_ahash(struct ahash_alg *alg); | ||
68 | int crypto_unregister_ahash(struct ahash_alg *alg); | ||
69 | int ahash_register_instance(struct crypto_template *tmpl, | ||
70 | struct ahash_instance *inst); | ||
71 | void ahash_free_instance(struct crypto_instance *inst); | ||
72 | |||
73 | int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn, | ||
74 | struct hash_alg_common *alg, | ||
75 | struct crypto_instance *inst); | ||
76 | |||
77 | static inline void crypto_drop_ahash(struct crypto_ahash_spawn *spawn) | ||
78 | { | ||
79 | crypto_drop_spawn(&spawn->base); | ||
80 | } | ||
81 | |||
82 | struct hash_alg_common *ahash_attr_alg(struct rtattr *rta, u32 type, u32 mask); | ||
83 | |||
46 | int crypto_register_shash(struct shash_alg *alg); | 84 | int crypto_register_shash(struct shash_alg *alg); |
47 | int crypto_unregister_shash(struct shash_alg *alg); | 85 | int crypto_unregister_shash(struct shash_alg *alg); |
86 | int shash_register_instance(struct crypto_template *tmpl, | ||
87 | struct shash_instance *inst); | ||
88 | void shash_free_instance(struct crypto_instance *inst); | ||
89 | |||
90 | int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn, | ||
91 | struct shash_alg *alg, | ||
92 | struct crypto_instance *inst); | ||
93 | |||
94 | static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn) | ||
95 | { | ||
96 | crypto_drop_spawn(&spawn->base); | ||
97 | } | ||
98 | |||
99 | struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask); | ||
100 | |||
101 | int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc); | ||
102 | int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc); | ||
103 | int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); | ||
104 | |||
105 | int crypto_init_shash_ops_async(struct crypto_tfm *tfm); | ||
48 | 106 | ||
49 | static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) | 107 | static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) |
50 | { | 108 | { |
51 | return crypto_tfm_ctx(&tfm->base); | 109 | return crypto_tfm_ctx(crypto_ahash_tfm(tfm)); |
110 | } | ||
111 | |||
112 | static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg) | ||
113 | { | ||
114 | return container_of(__crypto_hash_alg_common(alg), struct ahash_alg, | ||
115 | halg); | ||
116 | } | ||
117 | |||
118 | static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm, | ||
119 | unsigned int reqsize) | ||
120 | { | ||
121 | tfm->reqsize = reqsize; | ||
122 | } | ||
123 | |||
124 | static inline struct crypto_instance *ahash_crypto_instance( | ||
125 | struct ahash_instance *inst) | ||
126 | { | ||
127 | return container_of(&inst->alg.halg.base, struct crypto_instance, alg); | ||
52 | } | 128 | } |
53 | 129 | ||
54 | static inline struct ahash_alg *crypto_ahash_alg( | 130 | static inline struct ahash_instance *ahash_instance( |
55 | struct crypto_ahash *tfm) | 131 | struct crypto_instance *inst) |
56 | { | 132 | { |
57 | return &crypto_ahash_tfm(tfm)->__crt_alg->cra_ahash; | 133 | return container_of(&inst->alg, struct ahash_instance, alg.halg.base); |
134 | } | ||
135 | |||
136 | static inline void *ahash_instance_ctx(struct ahash_instance *inst) | ||
137 | { | ||
138 | return crypto_instance_ctx(ahash_crypto_instance(inst)); | ||
139 | } | ||
140 | |||
141 | static inline unsigned int ahash_instance_headroom(void) | ||
142 | { | ||
143 | return sizeof(struct ahash_alg) - sizeof(struct crypto_alg); | ||
144 | } | ||
145 | |||
146 | static inline struct ahash_instance *ahash_alloc_instance( | ||
147 | const char *name, struct crypto_alg *alg) | ||
148 | { | ||
149 | return crypto_alloc_instance2(name, alg, ahash_instance_headroom()); | ||
150 | } | ||
151 | |||
152 | static inline struct crypto_ahash *crypto_spawn_ahash( | ||
153 | struct crypto_ahash_spawn *spawn) | ||
154 | { | ||
155 | return crypto_spawn_tfm2(&spawn->base); | ||
58 | } | 156 | } |
59 | 157 | ||
60 | static inline int ahash_enqueue_request(struct crypto_queue *queue, | 158 | static inline int ahash_enqueue_request(struct crypto_queue *queue, |
@@ -80,5 +178,46 @@ static inline void *crypto_shash_ctx(struct crypto_shash *tfm) | |||
80 | return crypto_tfm_ctx(&tfm->base); | 178 | return crypto_tfm_ctx(&tfm->base); |
81 | } | 179 | } |
82 | 180 | ||
181 | static inline struct crypto_instance *shash_crypto_instance( | ||
182 | struct shash_instance *inst) | ||
183 | { | ||
184 | return container_of(&inst->alg.base, struct crypto_instance, alg); | ||
185 | } | ||
186 | |||
187 | static inline struct shash_instance *shash_instance( | ||
188 | struct crypto_instance *inst) | ||
189 | { | ||
190 | return container_of(__crypto_shash_alg(&inst->alg), | ||
191 | struct shash_instance, alg); | ||
192 | } | ||
193 | |||
194 | static inline void *shash_instance_ctx(struct shash_instance *inst) | ||
195 | { | ||
196 | return crypto_instance_ctx(shash_crypto_instance(inst)); | ||
197 | } | ||
198 | |||
199 | static inline struct shash_instance *shash_alloc_instance( | ||
200 | const char *name, struct crypto_alg *alg) | ||
201 | { | ||
202 | return crypto_alloc_instance2(name, alg, | ||
203 | sizeof(struct shash_alg) - sizeof(*alg)); | ||
204 | } | ||
205 | |||
206 | static inline struct crypto_shash *crypto_spawn_shash( | ||
207 | struct crypto_shash_spawn *spawn) | ||
208 | { | ||
209 | return crypto_spawn_tfm2(&spawn->base); | ||
210 | } | ||
211 | |||
212 | static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm) | ||
213 | { | ||
214 | return crypto_tfm_ctx_aligned(&tfm->base); | ||
215 | } | ||
216 | |||
217 | static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm) | ||
218 | { | ||
219 | return container_of(tfm, struct crypto_shash, base); | ||
220 | } | ||
221 | |||
83 | #endif /* _CRYPTO_INTERNAL_HASH_H */ | 222 | #endif /* _CRYPTO_INTERNAL_HASH_H */ |
84 | 223 | ||
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 2ba42cd7d6aa..3a748a6bf772 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -79,8 +79,8 @@ static inline int skcipher_enqueue_givcrypt( | |||
79 | static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( | 79 | static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( |
80 | struct crypto_queue *queue) | 80 | struct crypto_queue *queue) |
81 | { | 81 | { |
82 | return container_of(ablkcipher_dequeue_request(queue), | 82 | return __crypto_dequeue_request( |
83 | struct skcipher_givcrypt_request, creq); | 83 | queue, offsetof(struct skcipher_givcrypt_request, creq.base)); |
84 | } | 84 | } |
85 | 85 | ||
86 | static inline void *skcipher_givcrypt_reqctx( | 86 | static inline void *skcipher_givcrypt_reqctx( |
diff --git a/include/crypto/sha.h b/include/crypto/sha.h index c0ccc2b1a2d8..069e85ba97e1 100644 --- a/include/crypto/sha.h +++ b/include/crypto/sha.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #ifndef _CRYPTO_SHA_H | 5 | #ifndef _CRYPTO_SHA_H |
6 | #define _CRYPTO_SHA_H | 6 | #define _CRYPTO_SHA_H |
7 | 7 | ||
8 | #include <linux/types.h> | ||
9 | |||
8 | #define SHA1_DIGEST_SIZE 20 | 10 | #define SHA1_DIGEST_SIZE 20 |
9 | #define SHA1_BLOCK_SIZE 64 | 11 | #define SHA1_BLOCK_SIZE 64 |
10 | 12 | ||
@@ -62,4 +64,22 @@ | |||
62 | #define SHA512_H6 0x1f83d9abfb41bd6bULL | 64 | #define SHA512_H6 0x1f83d9abfb41bd6bULL |
63 | #define SHA512_H7 0x5be0cd19137e2179ULL | 65 | #define SHA512_H7 0x5be0cd19137e2179ULL |
64 | 66 | ||
67 | struct sha1_state { | ||
68 | u64 count; | ||
69 | u32 state[SHA1_DIGEST_SIZE / 4]; | ||
70 | u8 buffer[SHA1_BLOCK_SIZE]; | ||
71 | }; | ||
72 | |||
73 | struct sha256_state { | ||
74 | u64 count; | ||
75 | u32 state[SHA256_DIGEST_SIZE / 4]; | ||
76 | u8 buf[SHA256_BLOCK_SIZE]; | ||
77 | }; | ||
78 | |||
79 | struct sha512_state { | ||
80 | u64 count[2]; | ||
81 | u64 state[SHA512_DIGEST_SIZE / 8]; | ||
82 | u8 buf[SHA512_BLOCK_SIZE]; | ||
83 | }; | ||
84 | |||
65 | #endif | 85 | #endif |
diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h new file mode 100644 index 000000000000..c4467c55df1e --- /dev/null +++ b/include/crypto/vmac.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Modified to interface to the Linux kernel | ||
3 | * Copyright (c) 2009, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
16 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __CRYPTO_VMAC_H | ||
20 | #define __CRYPTO_VMAC_H | ||
21 | |||
22 | /* -------------------------------------------------------------------------- | ||
23 | * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai. | ||
24 | * This implementation is herby placed in the public domain. | ||
25 | * The authors offers no warranty. Use at your own risk. | ||
26 | * Please send bug reports to the authors. | ||
27 | * Last modified: 17 APR 08, 1700 PDT | ||
28 | * ----------------------------------------------------------------------- */ | ||
29 | |||
30 | /* | ||
31 | * User definable settings. | ||
32 | */ | ||
33 | #define VMAC_TAG_LEN 64 | ||
34 | #define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */ | ||
35 | #define VMAC_KEY_LEN (VMAC_KEY_SIZE/8) | ||
36 | #define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/ | ||
37 | |||
38 | /* | ||
39 | * This implementation uses u32 and u64 as names for unsigned 32- | ||
40 | * and 64-bit integer types. These are defined in C99 stdint.h. The | ||
41 | * following may need adaptation if you are not running a C99 or | ||
42 | * Microsoft C environment. | ||
43 | */ | ||
44 | struct vmac_ctx { | ||
45 | u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)]; | ||
46 | u64 polykey[2*VMAC_TAG_LEN/64]; | ||
47 | u64 l3key[2*VMAC_TAG_LEN/64]; | ||
48 | u64 polytmp[2*VMAC_TAG_LEN/64]; | ||
49 | u64 cached_nonce[2]; | ||
50 | u64 cached_aes[2]; | ||
51 | int first_block_processed; | ||
52 | }; | ||
53 | |||
54 | typedef u64 vmac_t; | ||
55 | |||
56 | struct vmac_ctx_t { | ||
57 | struct crypto_cipher *child; | ||
58 | struct vmac_ctx __vmac_ctx; | ||
59 | }; | ||
60 | |||
61 | #endif /* __CRYPTO_VMAC_H */ | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 1d52425a6118..f169bcb90b58 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/proportions.h> | 13 | #include <linux/proportions.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/sched.h> | ||
17 | #include <linux/writeback.h> | ||
16 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
17 | 19 | ||
18 | struct page; | 20 | struct page; |
@@ -23,9 +25,11 @@ struct dentry; | |||
23 | * Bits in backing_dev_info.state | 25 | * Bits in backing_dev_info.state |
24 | */ | 26 | */ |
25 | enum bdi_state { | 27 | enum bdi_state { |
26 | BDI_pdflush, /* A pdflush thread is working this device */ | 28 | BDI_pending, /* On its way to being activated */ |
29 | BDI_wb_alloc, /* Default embedded wb allocated */ | ||
27 | BDI_async_congested, /* The async (write) queue is getting full */ | 30 | BDI_async_congested, /* The async (write) queue is getting full */ |
28 | BDI_sync_congested, /* The sync queue is getting full */ | 31 | BDI_sync_congested, /* The sync queue is getting full */ |
32 | BDI_registered, /* bdi_register() was done */ | ||
29 | BDI_unused, /* Available bits start here */ | 33 | BDI_unused, /* Available bits start here */ |
30 | }; | 34 | }; |
31 | 35 | ||
@@ -39,7 +43,22 @@ enum bdi_stat_item { | |||
39 | 43 | ||
40 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) | 44 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) |
41 | 45 | ||
46 | struct bdi_writeback { | ||
47 | struct list_head list; /* hangs off the bdi */ | ||
48 | |||
49 | struct backing_dev_info *bdi; /* our parent bdi */ | ||
50 | unsigned int nr; | ||
51 | |||
52 | unsigned long last_old_flush; /* last old data flush */ | ||
53 | |||
54 | struct task_struct *task; /* writeback task */ | ||
55 | struct list_head b_dirty; /* dirty inodes */ | ||
56 | struct list_head b_io; /* parked for writeback */ | ||
57 | struct list_head b_more_io; /* parked for more writeback */ | ||
58 | }; | ||
59 | |||
42 | struct backing_dev_info { | 60 | struct backing_dev_info { |
61 | struct list_head bdi_list; | ||
43 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ | 62 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ |
44 | unsigned long state; /* Always use atomic bitops on this */ | 63 | unsigned long state; /* Always use atomic bitops on this */ |
45 | unsigned int capabilities; /* Device capabilities */ | 64 | unsigned int capabilities; /* Device capabilities */ |
@@ -48,6 +67,8 @@ struct backing_dev_info { | |||
48 | void (*unplug_io_fn)(struct backing_dev_info *, struct page *); | 67 | void (*unplug_io_fn)(struct backing_dev_info *, struct page *); |
49 | void *unplug_io_data; | 68 | void *unplug_io_data; |
50 | 69 | ||
70 | char *name; | ||
71 | |||
51 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; | 72 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; |
52 | 73 | ||
53 | struct prop_local_percpu completions; | 74 | struct prop_local_percpu completions; |
@@ -56,6 +77,14 @@ struct backing_dev_info { | |||
56 | unsigned int min_ratio; | 77 | unsigned int min_ratio; |
57 | unsigned int max_ratio, max_prop_frac; | 78 | unsigned int max_ratio, max_prop_frac; |
58 | 79 | ||
80 | struct bdi_writeback wb; /* default writeback info for this bdi */ | ||
81 | spinlock_t wb_lock; /* protects update side of wb_list */ | ||
82 | struct list_head wb_list; /* the flusher threads hanging off this bdi */ | ||
83 | unsigned long wb_mask; /* bitmask of registered tasks */ | ||
84 | unsigned int wb_cnt; /* number of registered tasks */ | ||
85 | |||
86 | struct list_head work_list; | ||
87 | |||
59 | struct device *dev; | 88 | struct device *dev; |
60 | 89 | ||
61 | #ifdef CONFIG_DEBUG_FS | 90 | #ifdef CONFIG_DEBUG_FS |
@@ -71,6 +100,19 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
71 | const char *fmt, ...); | 100 | const char *fmt, ...); |
72 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 101 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
73 | void bdi_unregister(struct backing_dev_info *bdi); | 102 | void bdi_unregister(struct backing_dev_info *bdi); |
103 | void bdi_start_writeback(struct writeback_control *wbc); | ||
104 | int bdi_writeback_task(struct bdi_writeback *wb); | ||
105 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | ||
106 | |||
107 | extern spinlock_t bdi_lock; | ||
108 | extern struct list_head bdi_list; | ||
109 | |||
110 | static inline int wb_has_dirty_io(struct bdi_writeback *wb) | ||
111 | { | ||
112 | return !list_empty(&wb->b_dirty) || | ||
113 | !list_empty(&wb->b_io) || | ||
114 | !list_empty(&wb->b_more_io); | ||
115 | } | ||
74 | 116 | ||
75 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, | 117 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, |
76 | enum bdi_stat_item item, s64 amount) | 118 | enum bdi_stat_item item, s64 amount) |
@@ -261,6 +303,11 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi) | |||
261 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; | 303 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; |
262 | } | 304 | } |
263 | 305 | ||
306 | static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi) | ||
307 | { | ||
308 | return bdi == &default_backing_dev_info; | ||
309 | } | ||
310 | |||
264 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) | 311 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
265 | { | 312 | { |
266 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 313 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); |
@@ -276,4 +323,10 @@ static inline bool mapping_cap_swap_backed(struct address_space *mapping) | |||
276 | return bdi_cap_swap_backed(mapping->backing_dev_info); | 323 | return bdi_cap_swap_backed(mapping->backing_dev_info); |
277 | } | 324 | } |
278 | 325 | ||
326 | static inline int bdi_sched_wait(void *word) | ||
327 | { | ||
328 | schedule(); | ||
329 | return 0; | ||
330 | } | ||
331 | |||
279 | #endif /* _LINUX_BACKING_DEV_H */ | 332 | #endif /* _LINUX_BACKING_DEV_H */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 61ee18c1bdb4..2046b5b8af48 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -117,6 +117,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, | |||
117 | int executable_stack); | 117 | int executable_stack); |
118 | extern int bprm_mm_init(struct linux_binprm *bprm); | 118 | extern int bprm_mm_init(struct linux_binprm *bprm); |
119 | extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); | 119 | extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); |
120 | extern int prepare_bprm_creds(struct linux_binprm *bprm); | ||
120 | extern void install_exec_creds(struct linux_binprm *bprm); | 121 | extern void install_exec_creds(struct linux_binprm *bprm); |
121 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); | 122 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); |
122 | extern int set_binfmt(struct linux_binfmt *new); | 123 | extern int set_binfmt(struct linux_binfmt *new); |
diff --git a/include/linux/cred.h b/include/linux/cred.h index 4fa999696310..24520a539c6f 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
@@ -114,6 +114,13 @@ struct thread_group_cred { | |||
114 | */ | 114 | */ |
115 | struct cred { | 115 | struct cred { |
116 | atomic_t usage; | 116 | atomic_t usage; |
117 | #ifdef CONFIG_DEBUG_CREDENTIALS | ||
118 | atomic_t subscribers; /* number of processes subscribed */ | ||
119 | void *put_addr; | ||
120 | unsigned magic; | ||
121 | #define CRED_MAGIC 0x43736564 | ||
122 | #define CRED_MAGIC_DEAD 0x44656144 | ||
123 | #endif | ||
117 | uid_t uid; /* real UID of the task */ | 124 | uid_t uid; /* real UID of the task */ |
118 | gid_t gid; /* real GID of the task */ | 125 | gid_t gid; /* real GID of the task */ |
119 | uid_t suid; /* saved UID of the task */ | 126 | uid_t suid; /* saved UID of the task */ |
@@ -143,7 +150,9 @@ struct cred { | |||
143 | }; | 150 | }; |
144 | 151 | ||
145 | extern void __put_cred(struct cred *); | 152 | extern void __put_cred(struct cred *); |
153 | extern void exit_creds(struct task_struct *); | ||
146 | extern int copy_creds(struct task_struct *, unsigned long); | 154 | extern int copy_creds(struct task_struct *, unsigned long); |
155 | extern struct cred *cred_alloc_blank(void); | ||
147 | extern struct cred *prepare_creds(void); | 156 | extern struct cred *prepare_creds(void); |
148 | extern struct cred *prepare_exec_creds(void); | 157 | extern struct cred *prepare_exec_creds(void); |
149 | extern struct cred *prepare_usermodehelper_creds(void); | 158 | extern struct cred *prepare_usermodehelper_creds(void); |
@@ -158,6 +167,60 @@ extern int set_security_override_from_ctx(struct cred *, const char *); | |||
158 | extern int set_create_files_as(struct cred *, struct inode *); | 167 | extern int set_create_files_as(struct cred *, struct inode *); |
159 | extern void __init cred_init(void); | 168 | extern void __init cred_init(void); |
160 | 169 | ||
170 | /* | ||
171 | * check for validity of credentials | ||
172 | */ | ||
173 | #ifdef CONFIG_DEBUG_CREDENTIALS | ||
174 | extern void __invalid_creds(const struct cred *, const char *, unsigned); | ||
175 | extern void __validate_process_creds(struct task_struct *, | ||
176 | const char *, unsigned); | ||
177 | |||
178 | static inline bool creds_are_invalid(const struct cred *cred) | ||
179 | { | ||
180 | if (cred->magic != CRED_MAGIC) | ||
181 | return true; | ||
182 | if (atomic_read(&cred->usage) < atomic_read(&cred->subscribers)) | ||
183 | return true; | ||
184 | #ifdef CONFIG_SECURITY_SELINUX | ||
185 | if ((unsigned long) cred->security < PAGE_SIZE) | ||
186 | return true; | ||
187 | if ((*(u32*)cred->security & 0xffffff00) == | ||
188 | (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8)) | ||
189 | return true; | ||
190 | #endif | ||
191 | return false; | ||
192 | } | ||
193 | |||
194 | static inline void __validate_creds(const struct cred *cred, | ||
195 | const char *file, unsigned line) | ||
196 | { | ||
197 | if (unlikely(creds_are_invalid(cred))) | ||
198 | __invalid_creds(cred, file, line); | ||
199 | } | ||
200 | |||
201 | #define validate_creds(cred) \ | ||
202 | do { \ | ||
203 | __validate_creds((cred), __FILE__, __LINE__); \ | ||
204 | } while(0) | ||
205 | |||
206 | #define validate_process_creds() \ | ||
207 | do { \ | ||
208 | __validate_process_creds(current, __FILE__, __LINE__); \ | ||
209 | } while(0) | ||
210 | |||
211 | extern void validate_creds_for_do_exit(struct task_struct *); | ||
212 | #else | ||
213 | static inline void validate_creds(const struct cred *cred) | ||
214 | { | ||
215 | } | ||
216 | static inline void validate_creds_for_do_exit(struct task_struct *tsk) | ||
217 | { | ||
218 | } | ||
219 | static inline void validate_process_creds(void) | ||
220 | { | ||
221 | } | ||
222 | #endif | ||
223 | |||
161 | /** | 224 | /** |
162 | * get_new_cred - Get a reference on a new set of credentials | 225 | * get_new_cred - Get a reference on a new set of credentials |
163 | * @cred: The new credentials to reference | 226 | * @cred: The new credentials to reference |
@@ -186,7 +249,9 @@ static inline struct cred *get_new_cred(struct cred *cred) | |||
186 | */ | 249 | */ |
187 | static inline const struct cred *get_cred(const struct cred *cred) | 250 | static inline const struct cred *get_cred(const struct cred *cred) |
188 | { | 251 | { |
189 | return get_new_cred((struct cred *) cred); | 252 | struct cred *nonconst_cred = (struct cred *) cred; |
253 | validate_creds(cred); | ||
254 | return get_new_cred(nonconst_cred); | ||
190 | } | 255 | } |
191 | 256 | ||
192 | /** | 257 | /** |
@@ -204,7 +269,7 @@ static inline void put_cred(const struct cred *_cred) | |||
204 | { | 269 | { |
205 | struct cred *cred = (struct cred *) _cred; | 270 | struct cred *cred = (struct cred *) _cred; |
206 | 271 | ||
207 | BUG_ON(atomic_read(&(cred)->usage) <= 0); | 272 | validate_creds(cred); |
208 | if (atomic_dec_and_test(&(cred)->usage)) | 273 | if (atomic_dec_and_test(&(cred)->usage)) |
209 | __put_cred(cred); | 274 | __put_cred(cred); |
210 | } | 275 | } |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index ec29fa268b94..fd929889e8dc 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -115,7 +115,6 @@ struct crypto_async_request; | |||
115 | struct crypto_aead; | 115 | struct crypto_aead; |
116 | struct crypto_blkcipher; | 116 | struct crypto_blkcipher; |
117 | struct crypto_hash; | 117 | struct crypto_hash; |
118 | struct crypto_ahash; | ||
119 | struct crypto_rng; | 118 | struct crypto_rng; |
120 | struct crypto_tfm; | 119 | struct crypto_tfm; |
121 | struct crypto_type; | 120 | struct crypto_type; |
@@ -146,16 +145,6 @@ struct ablkcipher_request { | |||
146 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | 145 | void *__ctx[] CRYPTO_MINALIGN_ATTR; |
147 | }; | 146 | }; |
148 | 147 | ||
149 | struct ahash_request { | ||
150 | struct crypto_async_request base; | ||
151 | |||
152 | unsigned int nbytes; | ||
153 | struct scatterlist *src; | ||
154 | u8 *result; | ||
155 | |||
156 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
157 | }; | ||
158 | |||
159 | /** | 148 | /** |
160 | * struct aead_request - AEAD request | 149 | * struct aead_request - AEAD request |
161 | * @base: Common attributes for async crypto requests | 150 | * @base: Common attributes for async crypto requests |
@@ -220,18 +209,6 @@ struct ablkcipher_alg { | |||
220 | unsigned int ivsize; | 209 | unsigned int ivsize; |
221 | }; | 210 | }; |
222 | 211 | ||
223 | struct ahash_alg { | ||
224 | int (*init)(struct ahash_request *req); | ||
225 | int (*reinit)(struct ahash_request *req); | ||
226 | int (*update)(struct ahash_request *req); | ||
227 | int (*final)(struct ahash_request *req); | ||
228 | int (*digest)(struct ahash_request *req); | ||
229 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
230 | unsigned int keylen); | ||
231 | |||
232 | unsigned int digestsize; | ||
233 | }; | ||
234 | |||
235 | struct aead_alg { | 212 | struct aead_alg { |
236 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, | 213 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, |
237 | unsigned int keylen); | 214 | unsigned int keylen); |
@@ -318,7 +295,6 @@ struct rng_alg { | |||
318 | #define cra_cipher cra_u.cipher | 295 | #define cra_cipher cra_u.cipher |
319 | #define cra_digest cra_u.digest | 296 | #define cra_digest cra_u.digest |
320 | #define cra_hash cra_u.hash | 297 | #define cra_hash cra_u.hash |
321 | #define cra_ahash cra_u.ahash | ||
322 | #define cra_compress cra_u.compress | 298 | #define cra_compress cra_u.compress |
323 | #define cra_rng cra_u.rng | 299 | #define cra_rng cra_u.rng |
324 | 300 | ||
@@ -346,7 +322,6 @@ struct crypto_alg { | |||
346 | struct cipher_alg cipher; | 322 | struct cipher_alg cipher; |
347 | struct digest_alg digest; | 323 | struct digest_alg digest; |
348 | struct hash_alg hash; | 324 | struct hash_alg hash; |
349 | struct ahash_alg ahash; | ||
350 | struct compress_alg compress; | 325 | struct compress_alg compress; |
351 | struct rng_alg rng; | 326 | struct rng_alg rng; |
352 | } cra_u; | 327 | } cra_u; |
@@ -433,18 +408,6 @@ struct hash_tfm { | |||
433 | unsigned int digestsize; | 408 | unsigned int digestsize; |
434 | }; | 409 | }; |
435 | 410 | ||
436 | struct ahash_tfm { | ||
437 | int (*init)(struct ahash_request *req); | ||
438 | int (*update)(struct ahash_request *req); | ||
439 | int (*final)(struct ahash_request *req); | ||
440 | int (*digest)(struct ahash_request *req); | ||
441 | int (*setkey)(struct crypto_ahash *tfm, const u8 *key, | ||
442 | unsigned int keylen); | ||
443 | |||
444 | unsigned int digestsize; | ||
445 | unsigned int reqsize; | ||
446 | }; | ||
447 | |||
448 | struct compress_tfm { | 411 | struct compress_tfm { |
449 | int (*cot_compress)(struct crypto_tfm *tfm, | 412 | int (*cot_compress)(struct crypto_tfm *tfm, |
450 | const u8 *src, unsigned int slen, | 413 | const u8 *src, unsigned int slen, |
@@ -465,7 +428,6 @@ struct rng_tfm { | |||
465 | #define crt_blkcipher crt_u.blkcipher | 428 | #define crt_blkcipher crt_u.blkcipher |
466 | #define crt_cipher crt_u.cipher | 429 | #define crt_cipher crt_u.cipher |
467 | #define crt_hash crt_u.hash | 430 | #define crt_hash crt_u.hash |
468 | #define crt_ahash crt_u.ahash | ||
469 | #define crt_compress crt_u.compress | 431 | #define crt_compress crt_u.compress |
470 | #define crt_rng crt_u.rng | 432 | #define crt_rng crt_u.rng |
471 | 433 | ||
@@ -479,7 +441,6 @@ struct crypto_tfm { | |||
479 | struct blkcipher_tfm blkcipher; | 441 | struct blkcipher_tfm blkcipher; |
480 | struct cipher_tfm cipher; | 442 | struct cipher_tfm cipher; |
481 | struct hash_tfm hash; | 443 | struct hash_tfm hash; |
482 | struct ahash_tfm ahash; | ||
483 | struct compress_tfm compress; | 444 | struct compress_tfm compress; |
484 | struct rng_tfm rng; | 445 | struct rng_tfm rng; |
485 | } crt_u; | 446 | } crt_u; |
@@ -770,7 +731,7 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc( | |||
770 | 731 | ||
771 | static inline void ablkcipher_request_free(struct ablkcipher_request *req) | 732 | static inline void ablkcipher_request_free(struct ablkcipher_request *req) |
772 | { | 733 | { |
773 | kfree(req); | 734 | kzfree(req); |
774 | } | 735 | } |
775 | 736 | ||
776 | static inline void ablkcipher_request_set_callback( | 737 | static inline void ablkcipher_request_set_callback( |
@@ -901,7 +862,7 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, | |||
901 | 862 | ||
902 | static inline void aead_request_free(struct aead_request *req) | 863 | static inline void aead_request_free(struct aead_request *req) |
903 | { | 864 | { |
904 | kfree(req); | 865 | kzfree(req); |
905 | } | 866 | } |
906 | 867 | ||
907 | static inline void aead_request_set_callback(struct aead_request *req, | 868 | static inline void aead_request_set_callback(struct aead_request *req, |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 655e7721580a..df7607e6dce8 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -91,6 +91,9 @@ typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, | |||
91 | iterate_devices_callout_fn fn, | 91 | iterate_devices_callout_fn fn, |
92 | void *data); | 92 | void *data); |
93 | 93 | ||
94 | typedef void (*dm_io_hints_fn) (struct dm_target *ti, | ||
95 | struct queue_limits *limits); | ||
96 | |||
94 | /* | 97 | /* |
95 | * Returns: | 98 | * Returns: |
96 | * 0: The target can handle the next I/O immediately. | 99 | * 0: The target can handle the next I/O immediately. |
@@ -151,6 +154,7 @@ struct target_type { | |||
151 | dm_merge_fn merge; | 154 | dm_merge_fn merge; |
152 | dm_busy_fn busy; | 155 | dm_busy_fn busy; |
153 | dm_iterate_devices_fn iterate_devices; | 156 | dm_iterate_devices_fn iterate_devices; |
157 | dm_io_hints_fn io_hints; | ||
154 | 158 | ||
155 | /* For internal device-mapper use. */ | 159 | /* For internal device-mapper use. */ |
156 | struct list_head list; | 160 | struct list_head list; |
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h index 642e3017b51f..8a1f972c0fe9 100644 --- a/include/linux/dm-log-userspace.h +++ b/include/linux/dm-log-userspace.h | |||
@@ -371,7 +371,18 @@ | |||
371 | (DM_ULOG_REQUEST_MASK & (request_type)) | 371 | (DM_ULOG_REQUEST_MASK & (request_type)) |
372 | 372 | ||
373 | struct dm_ulog_request { | 373 | struct dm_ulog_request { |
374 | char uuid[DM_UUID_LEN]; /* Ties a request to a specific mirror log */ | 374 | /* |
375 | * The local unique identifier (luid) and the universally unique | ||
376 | * identifier (uuid) are used to tie a request to a specific | ||
377 | * mirror log. A single machine log could probably make due with | ||
378 | * just the 'luid', but a cluster-aware log must use the 'uuid' and | ||
379 | * the 'luid'. The uuid is what is required for node to node | ||
380 | * communication concerning a particular log, but the 'luid' helps | ||
381 | * differentiate between logs that are being swapped and have the | ||
382 | * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) | ||
383 | */ | ||
384 | uint64_t luid; | ||
385 | char uuid[DM_UUID_LEN]; | ||
375 | char padding[7]; /* Padding because DM_UUID_LEN = 129 */ | 386 | char padding[7]; /* Padding because DM_UUID_LEN = 129 */ |
376 | 387 | ||
377 | int32_t error; /* Used to report back processing errors */ | 388 | int32_t error; /* Used to report back processing errors */ |
diff --git a/include/linux/fips.h b/include/linux/fips.h new file mode 100644 index 000000000000..f8fb07b0b6b8 --- /dev/null +++ b/include/linux/fips.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _FIPS_H | ||
2 | #define _FIPS_H | ||
3 | |||
4 | #ifdef CONFIG_CRYPTO_FIPS | ||
5 | extern int fips_enabled; | ||
6 | #else | ||
7 | #define fips_enabled 0 | ||
8 | #endif | ||
9 | |||
10 | #endif | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 73e9b643e455..a79f48373e7e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -715,7 +715,7 @@ struct posix_acl; | |||
715 | 715 | ||
716 | struct inode { | 716 | struct inode { |
717 | struct hlist_node i_hash; | 717 | struct hlist_node i_hash; |
718 | struct list_head i_list; | 718 | struct list_head i_list; /* backing dev IO list */ |
719 | struct list_head i_sb_list; | 719 | struct list_head i_sb_list; |
720 | struct list_head i_dentry; | 720 | struct list_head i_dentry; |
721 | unsigned long i_ino; | 721 | unsigned long i_ino; |
@@ -1336,9 +1336,6 @@ struct super_block { | |||
1336 | struct xattr_handler **s_xattr; | 1336 | struct xattr_handler **s_xattr; |
1337 | 1337 | ||
1338 | struct list_head s_inodes; /* all inodes */ | 1338 | struct list_head s_inodes; /* all inodes */ |
1339 | struct list_head s_dirty; /* dirty inodes */ | ||
1340 | struct list_head s_io; /* parked for writeback */ | ||
1341 | struct list_head s_more_io; /* parked for more writeback */ | ||
1342 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1339 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ |
1343 | struct list_head s_files; | 1340 | struct list_head s_files; |
1344 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ | 1341 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ |
@@ -1528,6 +1525,7 @@ struct inode_operations { | |||
1528 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1525 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1529 | void (*truncate) (struct inode *); | 1526 | void (*truncate) (struct inode *); |
1530 | int (*permission) (struct inode *, int); | 1527 | int (*permission) (struct inode *, int); |
1528 | int (*check_acl)(struct inode *, int); | ||
1531 | int (*setattr) (struct dentry *, struct iattr *); | 1529 | int (*setattr) (struct dentry *, struct iattr *); |
1532 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1530 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
1533 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 1531 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
@@ -1788,6 +1786,7 @@ extern int get_sb_pseudo(struct file_system_type *, char *, | |||
1788 | struct vfsmount *mnt); | 1786 | struct vfsmount *mnt); |
1789 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1787 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1790 | int __put_super_and_need_restart(struct super_block *sb); | 1788 | int __put_super_and_need_restart(struct super_block *sb); |
1789 | void put_super(struct super_block *sb); | ||
1791 | 1790 | ||
1792 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1791 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
1793 | #define fops_get(fops) \ | 1792 | #define fops_get(fops) \ |
@@ -1998,12 +1997,25 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *); | |||
1998 | #define CHRDEV_MAJOR_HASH_SIZE 255 | 1997 | #define CHRDEV_MAJOR_HASH_SIZE 255 |
1999 | extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); | 1998 | extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); |
2000 | extern int register_chrdev_region(dev_t, unsigned, const char *); | 1999 | extern int register_chrdev_region(dev_t, unsigned, const char *); |
2001 | extern int register_chrdev(unsigned int, const char *, | 2000 | extern int __register_chrdev(unsigned int major, unsigned int baseminor, |
2002 | const struct file_operations *); | 2001 | unsigned int count, const char *name, |
2003 | extern void unregister_chrdev(unsigned int, const char *); | 2002 | const struct file_operations *fops); |
2003 | extern void __unregister_chrdev(unsigned int major, unsigned int baseminor, | ||
2004 | unsigned int count, const char *name); | ||
2004 | extern void unregister_chrdev_region(dev_t, unsigned); | 2005 | extern void unregister_chrdev_region(dev_t, unsigned); |
2005 | extern void chrdev_show(struct seq_file *,off_t); | 2006 | extern void chrdev_show(struct seq_file *,off_t); |
2006 | 2007 | ||
2008 | static inline int register_chrdev(unsigned int major, const char *name, | ||
2009 | const struct file_operations *fops) | ||
2010 | { | ||
2011 | return __register_chrdev(major, 0, 256, name, fops); | ||
2012 | } | ||
2013 | |||
2014 | static inline void unregister_chrdev(unsigned int major, const char *name) | ||
2015 | { | ||
2016 | __unregister_chrdev(major, 0, 256, name); | ||
2017 | } | ||
2018 | |||
2007 | /* fs/block_dev.c */ | 2019 | /* fs/block_dev.c */ |
2008 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 2020 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
2009 | #define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ | 2021 | #define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ |
@@ -2070,8 +2082,6 @@ static inline void invalidate_remote_inode(struct inode *inode) | |||
2070 | extern int invalidate_inode_pages2(struct address_space *mapping); | 2082 | extern int invalidate_inode_pages2(struct address_space *mapping); |
2071 | extern int invalidate_inode_pages2_range(struct address_space *mapping, | 2083 | extern int invalidate_inode_pages2_range(struct address_space *mapping, |
2072 | pgoff_t start, pgoff_t end); | 2084 | pgoff_t start, pgoff_t end); |
2073 | extern void generic_sync_sb_inodes(struct super_block *sb, | ||
2074 | struct writeback_control *wbc); | ||
2075 | extern int write_inode_now(struct inode *, int); | 2085 | extern int write_inode_now(struct inode *, int); |
2076 | extern int filemap_fdatawrite(struct address_space *); | 2086 | extern int filemap_fdatawrite(struct address_space *); |
2077 | extern int filemap_flush(struct address_space *); | 2087 | extern int filemap_flush(struct address_space *); |
@@ -2186,7 +2196,6 @@ extern int bdev_read_only(struct block_device *); | |||
2186 | extern int set_blocksize(struct block_device *, int); | 2196 | extern int set_blocksize(struct block_device *, int); |
2187 | extern int sb_set_blocksize(struct super_block *, int); | 2197 | extern int sb_set_blocksize(struct super_block *, int); |
2188 | extern int sb_min_blocksize(struct super_block *, int); | 2198 | extern int sb_min_blocksize(struct super_block *, int); |
2189 | extern int sb_has_dirty_inodes(struct super_block *); | ||
2190 | 2199 | ||
2191 | extern int generic_file_mmap(struct file *, struct vm_area_struct *); | 2200 | extern int generic_file_mmap(struct file *, struct vm_area_struct *); |
2192 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); | 2201 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); |
diff --git a/include/linux/key.h b/include/linux/key.h index e544f466d69a..cd50dfa1d4c2 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -129,7 +129,10 @@ struct key { | |||
129 | struct rw_semaphore sem; /* change vs change sem */ | 129 | struct rw_semaphore sem; /* change vs change sem */ |
130 | struct key_user *user; /* owner of this key */ | 130 | struct key_user *user; /* owner of this key */ |
131 | void *security; /* security data for this key */ | 131 | void *security; /* security data for this key */ |
132 | time_t expiry; /* time at which key expires (or 0) */ | 132 | union { |
133 | time_t expiry; /* time at which key expires (or 0) */ | ||
134 | time_t revoked_at; /* time at which key was revoked */ | ||
135 | }; | ||
133 | uid_t uid; | 136 | uid_t uid; |
134 | gid_t gid; | 137 | gid_t gid; |
135 | key_perm_t perm; /* access permissions */ | 138 | key_perm_t perm; /* access permissions */ |
@@ -275,6 +278,8 @@ static inline key_serial_t key_serial(struct key *key) | |||
275 | extern ctl_table key_sysctls[]; | 278 | extern ctl_table key_sysctls[]; |
276 | #endif | 279 | #endif |
277 | 280 | ||
281 | extern void key_replace_session_keyring(void); | ||
282 | |||
278 | /* | 283 | /* |
279 | * the userspace interface | 284 | * the userspace interface |
280 | */ | 285 | */ |
@@ -297,6 +302,7 @@ extern void key_init(void); | |||
297 | #define key_fsuid_changed(t) do { } while(0) | 302 | #define key_fsuid_changed(t) do { } while(0) |
298 | #define key_fsgid_changed(t) do { } while(0) | 303 | #define key_fsgid_changed(t) do { } while(0) |
299 | #define key_init() do { } while(0) | 304 | #define key_init() do { } while(0) |
305 | #define key_replace_session_keyring() do { } while(0) | ||
300 | 306 | ||
301 | #endif /* CONFIG_KEYS */ | 307 | #endif /* CONFIG_KEYS */ |
302 | #endif /* __KERNEL__ */ | 308 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h index c0688eb72093..bd383f1944fb 100644 --- a/include/linux/keyctl.h +++ b/include/linux/keyctl.h | |||
@@ -52,5 +52,6 @@ | |||
52 | #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ | 52 | #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ |
53 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ | 53 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ |
54 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ | 54 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ |
55 | #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ | ||
55 | 56 | ||
56 | #endif /* _LINUX_KEYCTL_H */ | 57 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index 47b39b7c7e84..dc2fd545db00 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h | |||
@@ -34,6 +34,8 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n); | |||
34 | int kmemcheck_show_addr(unsigned long address); | 34 | int kmemcheck_show_addr(unsigned long address); |
35 | int kmemcheck_hide_addr(unsigned long address); | 35 | int kmemcheck_hide_addr(unsigned long address); |
36 | 36 | ||
37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); | ||
38 | |||
37 | #else | 39 | #else |
38 | #define kmemcheck_enabled 0 | 40 | #define kmemcheck_enabled 0 |
39 | 41 | ||
@@ -99,6 +101,11 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p, | |||
99 | { | 101 | { |
100 | } | 102 | } |
101 | 103 | ||
104 | static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) | ||
105 | { | ||
106 | return true; | ||
107 | } | ||
108 | |||
102 | #endif /* CONFIG_KMEMCHECK */ | 109 | #endif /* CONFIG_KMEMCHECK */ |
103 | 110 | ||
104 | /* | 111 | /* |
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 6a63807f714e..3c7497d46ee9 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h | |||
@@ -23,18 +23,18 @@ | |||
23 | 23 | ||
24 | #ifdef CONFIG_DEBUG_KMEMLEAK | 24 | #ifdef CONFIG_DEBUG_KMEMLEAK |
25 | 25 | ||
26 | extern void kmemleak_init(void); | 26 | extern void kmemleak_init(void) __ref; |
27 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, | 27 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, |
28 | gfp_t gfp); | 28 | gfp_t gfp) __ref; |
29 | extern void kmemleak_free(const void *ptr); | 29 | extern void kmemleak_free(const void *ptr) __ref; |
30 | extern void kmemleak_free_part(const void *ptr, size_t size); | 30 | extern void kmemleak_free_part(const void *ptr, size_t size) __ref; |
31 | extern void kmemleak_padding(const void *ptr, unsigned long offset, | 31 | extern void kmemleak_padding(const void *ptr, unsigned long offset, |
32 | size_t size); | 32 | size_t size) __ref; |
33 | extern void kmemleak_not_leak(const void *ptr); | 33 | extern void kmemleak_not_leak(const void *ptr) __ref; |
34 | extern void kmemleak_ignore(const void *ptr); | 34 | extern void kmemleak_ignore(const void *ptr) __ref; |
35 | extern void kmemleak_scan_area(const void *ptr, unsigned long offset, | 35 | extern void kmemleak_scan_area(const void *ptr, unsigned long offset, |
36 | size_t length, gfp_t gfp); | 36 | size_t length, gfp_t gfp) __ref; |
37 | extern void kmemleak_no_scan(const void *ptr); | 37 | extern void kmemleak_no_scan(const void *ptr) __ref; |
38 | 38 | ||
39 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, | 39 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, |
40 | int min_count, unsigned long flags, | 40 | int min_count, unsigned long flags, |
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h index e461b2c3d711..190c37854870 100644 --- a/include/linux/lsm_audit.h +++ b/include/linux/lsm_audit.h | |||
@@ -33,6 +33,7 @@ struct common_audit_data { | |||
33 | #define LSM_AUDIT_DATA_IPC 4 | 33 | #define LSM_AUDIT_DATA_IPC 4 |
34 | #define LSM_AUDIT_DATA_TASK 5 | 34 | #define LSM_AUDIT_DATA_TASK 5 |
35 | #define LSM_AUDIT_DATA_KEY 6 | 35 | #define LSM_AUDIT_DATA_KEY 6 |
36 | #define LSM_AUDIT_NO_AUDIT 7 | ||
36 | struct task_struct *tsk; | 37 | struct task_struct *tsk; |
37 | union { | 38 | union { |
38 | struct { | 39 | struct { |
@@ -66,16 +67,19 @@ struct common_audit_data { | |||
66 | } key_struct; | 67 | } key_struct; |
67 | #endif | 68 | #endif |
68 | } u; | 69 | } u; |
69 | const char *function; | ||
70 | /* this union contains LSM specific data */ | 70 | /* this union contains LSM specific data */ |
71 | union { | 71 | union { |
72 | #ifdef CONFIG_SECURITY_SMACK | ||
72 | /* SMACK data */ | 73 | /* SMACK data */ |
73 | struct smack_audit_data { | 74 | struct smack_audit_data { |
75 | const char *function; | ||
74 | char *subject; | 76 | char *subject; |
75 | char *object; | 77 | char *object; |
76 | char *request; | 78 | char *request; |
77 | int result; | 79 | int result; |
78 | } smack_audit_data; | 80 | } smack_audit_data; |
81 | #endif | ||
82 | #ifdef CONFIG_SECURITY_SELINUX | ||
79 | /* SELinux data */ | 83 | /* SELinux data */ |
80 | struct { | 84 | struct { |
81 | u32 ssid; | 85 | u32 ssid; |
@@ -83,10 +87,12 @@ struct common_audit_data { | |||
83 | u16 tclass; | 87 | u16 tclass; |
84 | u32 requested; | 88 | u32 requested; |
85 | u32 audited; | 89 | u32 audited; |
90 | u32 denied; | ||
86 | struct av_decision *avd; | 91 | struct av_decision *avd; |
87 | int result; | 92 | int result; |
88 | } selinux_audit_data; | 93 | } selinux_audit_data; |
89 | } lsm_priv; | 94 | #endif |
95 | }; | ||
90 | /* these callback will be implemented by a specific LSM */ | 96 | /* these callback will be implemented by a specific LSM */ |
91 | void (*lsm_pre_audit)(struct audit_buffer *, void *); | 97 | void (*lsm_pre_audit)(struct audit_buffer *, void *); |
92 | void (*lsm_post_audit)(struct audit_buffer *, void *); | 98 | void (*lsm_post_audit)(struct audit_buffer *, void *); |
@@ -104,7 +110,7 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
104 | /* Initialize an LSM audit data structure. */ | 110 | /* Initialize an LSM audit data structure. */ |
105 | #define COMMON_AUDIT_DATA_INIT(_d, _t) \ | 111 | #define COMMON_AUDIT_DATA_INIT(_d, _t) \ |
106 | { memset((_d), 0, sizeof(struct common_audit_data)); \ | 112 | { memset((_d), 0, sizeof(struct common_audit_data)); \ |
107 | (_d)->type = LSM_AUDIT_DATA_##_t; (_d)->function = __func__; } | 113 | (_d)->type = LSM_AUDIT_DATA_##_t; } |
108 | 114 | ||
109 | void common_lsm_audit(struct common_audit_data *a); | 115 | void common_lsm_audit(struct common_audit_data *a); |
110 | 116 | ||
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 29af2d5df097..b752e807adde 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -28,8 +28,23 @@ static inline void acpi_nmi_disable(void) { } | |||
28 | static inline void acpi_nmi_enable(void) { } | 28 | static inline void acpi_nmi_enable(void) { } |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifndef trigger_all_cpu_backtrace | 31 | /* |
32 | #define trigger_all_cpu_backtrace() do { } while (0) | 32 | * Create trigger_all_cpu_backtrace() out of the arch-provided |
33 | * base function. Return whether such support was available, | ||
34 | * to allow calling code to fall back to some other mechanism: | ||
35 | */ | ||
36 | #ifdef arch_trigger_all_cpu_backtrace | ||
37 | static inline bool trigger_all_cpu_backtrace(void) | ||
38 | { | ||
39 | arch_trigger_all_cpu_backtrace(); | ||
40 | |||
41 | return true; | ||
42 | } | ||
43 | #else | ||
44 | static inline bool trigger_all_cpu_backtrace(void) | ||
45 | { | ||
46 | return false; | ||
47 | } | ||
33 | #endif | 48 | #endif |
34 | 49 | ||
35 | #endif | 50 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0f1ea4a66957..9304027673b0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1292,6 +1292,7 @@ struct task_struct { | |||
1292 | struct mutex cred_guard_mutex; /* guard against foreign influences on | 1292 | struct mutex cred_guard_mutex; /* guard against foreign influences on |
1293 | * credential calculations | 1293 | * credential calculations |
1294 | * (notably. ptrace) */ | 1294 | * (notably. ptrace) */ |
1295 | struct cred *replacement_session_keyring; /* for KEYCTL_SESSION_TO_PARENT */ | ||
1295 | 1296 | ||
1296 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1297 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
1297 | - access with [gs]et_task_comm (which lock | 1298 | - access with [gs]et_task_comm (which lock |
@@ -2077,7 +2078,7 @@ static inline unsigned long wait_task_inactive(struct task_struct *p, | |||
2077 | #define for_each_process(p) \ | 2078 | #define for_each_process(p) \ |
2078 | for (p = &init_task ; (p = next_task(p)) != &init_task ; ) | 2079 | for (p = &init_task ; (p = next_task(p)) != &init_task ; ) |
2079 | 2080 | ||
2080 | extern bool is_single_threaded(struct task_struct *); | 2081 | extern bool current_is_single_threaded(void); |
2081 | 2082 | ||
2082 | /* | 2083 | /* |
2083 | * Careful: do_each_thread/while_each_thread is a double loop so | 2084 | * Careful: do_each_thread/while_each_thread is a double loop so |
diff --git a/include/linux/security.h b/include/linux/security.h index 1f16eea2017b..d050b66ab9ef 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -53,7 +53,7 @@ struct audit_krule; | |||
53 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, | 53 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, |
54 | int cap, int audit); | 54 | int cap, int audit); |
55 | extern int cap_settime(struct timespec *ts, struct timezone *tz); | 55 | extern int cap_settime(struct timespec *ts, struct timezone *tz); |
56 | extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); | 56 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); |
57 | extern int cap_ptrace_traceme(struct task_struct *parent); | 57 | extern int cap_ptrace_traceme(struct task_struct *parent); |
58 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 58 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
59 | extern int cap_capset(struct cred *new, const struct cred *old, | 59 | extern int cap_capset(struct cred *new, const struct cred *old, |
@@ -653,6 +653,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
653 | * manual page for definitions of the @clone_flags. | 653 | * manual page for definitions of the @clone_flags. |
654 | * @clone_flags contains the flags indicating what should be shared. | 654 | * @clone_flags contains the flags indicating what should be shared. |
655 | * Return 0 if permission is granted. | 655 | * Return 0 if permission is granted. |
656 | * @cred_alloc_blank: | ||
657 | * @cred points to the credentials. | ||
658 | * @gfp indicates the atomicity of any memory allocations. | ||
659 | * Only allocate sufficient memory and attach to @cred such that | ||
660 | * cred_transfer() will not get ENOMEM. | ||
656 | * @cred_free: | 661 | * @cred_free: |
657 | * @cred points to the credentials. | 662 | * @cred points to the credentials. |
658 | * Deallocate and clear the cred->security field in a set of credentials. | 663 | * Deallocate and clear the cred->security field in a set of credentials. |
@@ -665,6 +670,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
665 | * @new points to the new credentials. | 670 | * @new points to the new credentials. |
666 | * @old points to the original credentials. | 671 | * @old points to the original credentials. |
667 | * Install a new set of credentials. | 672 | * Install a new set of credentials. |
673 | * @cred_transfer: | ||
674 | * @new points to the new credentials. | ||
675 | * @old points to the original credentials. | ||
676 | * Transfer data from original creds to new creds | ||
668 | * @kernel_act_as: | 677 | * @kernel_act_as: |
669 | * Set the credentials for a kernel service to act as (subjective context). | 678 | * Set the credentials for a kernel service to act as (subjective context). |
670 | * @new points to the credentials to be modified. | 679 | * @new points to the credentials to be modified. |
@@ -678,6 +687,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
678 | * @inode points to the inode to use as a reference. | 687 | * @inode points to the inode to use as a reference. |
679 | * The current task must be the one that nominated @inode. | 688 | * The current task must be the one that nominated @inode. |
680 | * Return 0 if successful. | 689 | * Return 0 if successful. |
690 | * @kernel_module_request: | ||
691 | * Ability to trigger the kernel to automatically upcall to userspace for | ||
692 | * userspace to load a kernel module with the given name. | ||
693 | * Return 0 if successful. | ||
681 | * @task_setuid: | 694 | * @task_setuid: |
682 | * Check permission before setting one or more of the user identity | 695 | * Check permission before setting one or more of the user identity |
683 | * attributes of the current process. The @flags parameter indicates | 696 | * attributes of the current process. The @flags parameter indicates |
@@ -994,6 +1007,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
994 | * Sets the connection's peersid to the secmark on skb. | 1007 | * Sets the connection's peersid to the secmark on skb. |
995 | * @req_classify_flow: | 1008 | * @req_classify_flow: |
996 | * Sets the flow's sid to the openreq sid. | 1009 | * Sets the flow's sid to the openreq sid. |
1010 | * @tun_dev_create: | ||
1011 | * Check permissions prior to creating a new TUN device. | ||
1012 | * @tun_dev_post_create: | ||
1013 | * This hook allows a module to update or allocate a per-socket security | ||
1014 | * structure. | ||
1015 | * @sk contains the newly created sock structure. | ||
1016 | * @tun_dev_attach: | ||
1017 | * Check permissions prior to attaching to a persistent TUN device. This | ||
1018 | * hook can also be used by the module to update any security state | ||
1019 | * associated with the TUN device's sock structure. | ||
1020 | * @sk contains the existing sock structure. | ||
997 | * | 1021 | * |
998 | * Security hooks for XFRM operations. | 1022 | * Security hooks for XFRM operations. |
999 | * | 1023 | * |
@@ -1088,6 +1112,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1088 | * Return the length of the string (including terminating NUL) or -ve if | 1112 | * Return the length of the string (including terminating NUL) or -ve if |
1089 | * an error. | 1113 | * an error. |
1090 | * May also return 0 (and a NULL buffer pointer) if there is no label. | 1114 | * May also return 0 (and a NULL buffer pointer) if there is no label. |
1115 | * @key_session_to_parent: | ||
1116 | * Forcibly assign the session keyring from a process to its parent | ||
1117 | * process. | ||
1118 | * @cred: Pointer to process's credentials | ||
1119 | * @parent_cred: Pointer to parent process's credentials | ||
1120 | * @keyring: Proposed new session keyring | ||
1121 | * Return 0 if permission is granted, -ve error otherwise. | ||
1091 | * | 1122 | * |
1092 | * Security hooks affecting all System V IPC operations. | 1123 | * Security hooks affecting all System V IPC operations. |
1093 | * | 1124 | * |
@@ -1229,7 +1260,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1229 | * @alter contains the flag indicating whether changes are to be made. | 1260 | * @alter contains the flag indicating whether changes are to be made. |
1230 | * Return 0 if permission is granted. | 1261 | * Return 0 if permission is granted. |
1231 | * | 1262 | * |
1232 | * @ptrace_may_access: | 1263 | * @ptrace_access_check: |
1233 | * Check permission before allowing the current process to trace the | 1264 | * Check permission before allowing the current process to trace the |
1234 | * @child process. | 1265 | * @child process. |
1235 | * Security modules may also want to perform a process tracing check | 1266 | * Security modules may also want to perform a process tracing check |
@@ -1244,7 +1275,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1244 | * Check that the @parent process has sufficient permission to trace the | 1275 | * Check that the @parent process has sufficient permission to trace the |
1245 | * current process before allowing the current process to present itself | 1276 | * current process before allowing the current process to present itself |
1246 | * to the @parent process for tracing. | 1277 | * to the @parent process for tracing. |
1247 | * The parent process will still have to undergo the ptrace_may_access | 1278 | * The parent process will still have to undergo the ptrace_access_check |
1248 | * checks before it is allowed to trace this one. | 1279 | * checks before it is allowed to trace this one. |
1249 | * @parent contains the task_struct structure for debugger process. | 1280 | * @parent contains the task_struct structure for debugger process. |
1250 | * Return 0 if permission is granted. | 1281 | * Return 0 if permission is granted. |
@@ -1351,12 +1382,47 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1351 | * audit_rule_init. | 1382 | * audit_rule_init. |
1352 | * @rule contains the allocated rule | 1383 | * @rule contains the allocated rule |
1353 | * | 1384 | * |
1385 | * @inode_notifysecctx: | ||
1386 | * Notify the security module of what the security context of an inode | ||
1387 | * should be. Initializes the incore security context managed by the | ||
1388 | * security module for this inode. Example usage: NFS client invokes | ||
1389 | * this hook to initialize the security context in its incore inode to the | ||
1390 | * value provided by the server for the file when the server returned the | ||
1391 | * file's attributes to the client. | ||
1392 | * | ||
1393 | * Must be called with inode->i_mutex locked. | ||
1394 | * | ||
1395 | * @inode we wish to set the security context of. | ||
1396 | * @ctx contains the string which we wish to set in the inode. | ||
1397 | * @ctxlen contains the length of @ctx. | ||
1398 | * | ||
1399 | * @inode_setsecctx: | ||
1400 | * Change the security context of an inode. Updates the | ||
1401 | * incore security context managed by the security module and invokes the | ||
1402 | * fs code as needed (via __vfs_setxattr_noperm) to update any backing | ||
1403 | * xattrs that represent the context. Example usage: NFS server invokes | ||
1404 | * this hook to change the security context in its incore inode and on the | ||
1405 | * backing filesystem to a value provided by the client on a SETATTR | ||
1406 | * operation. | ||
1407 | * | ||
1408 | * Must be called with inode->i_mutex locked. | ||
1409 | * | ||
1410 | * @dentry contains the inode we wish to set the security context of. | ||
1411 | * @ctx contains the string which we wish to set in the inode. | ||
1412 | * @ctxlen contains the length of @ctx. | ||
1413 | * | ||
1414 | * @inode_getsecctx: | ||
1415 | * Returns a string containing all relavent security context information | ||
1416 | * | ||
1417 | * @inode we wish to set the security context of. | ||
1418 | * @ctx is a pointer in which to place the allocated security context. | ||
1419 | * @ctxlen points to the place to put the length of @ctx. | ||
1354 | * This is the main security structure. | 1420 | * This is the main security structure. |
1355 | */ | 1421 | */ |
1356 | struct security_operations { | 1422 | struct security_operations { |
1357 | char name[SECURITY_NAME_MAX + 1]; | 1423 | char name[SECURITY_NAME_MAX + 1]; |
1358 | 1424 | ||
1359 | int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); | 1425 | int (*ptrace_access_check) (struct task_struct *child, unsigned int mode); |
1360 | int (*ptrace_traceme) (struct task_struct *parent); | 1426 | int (*ptrace_traceme) (struct task_struct *parent); |
1361 | int (*capget) (struct task_struct *target, | 1427 | int (*capget) (struct task_struct *target, |
1362 | kernel_cap_t *effective, | 1428 | kernel_cap_t *effective, |
@@ -1483,12 +1549,15 @@ struct security_operations { | |||
1483 | int (*dentry_open) (struct file *file, const struct cred *cred); | 1549 | int (*dentry_open) (struct file *file, const struct cred *cred); |
1484 | 1550 | ||
1485 | int (*task_create) (unsigned long clone_flags); | 1551 | int (*task_create) (unsigned long clone_flags); |
1552 | int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); | ||
1486 | void (*cred_free) (struct cred *cred); | 1553 | void (*cred_free) (struct cred *cred); |
1487 | int (*cred_prepare)(struct cred *new, const struct cred *old, | 1554 | int (*cred_prepare)(struct cred *new, const struct cred *old, |
1488 | gfp_t gfp); | 1555 | gfp_t gfp); |
1489 | void (*cred_commit)(struct cred *new, const struct cred *old); | 1556 | void (*cred_commit)(struct cred *new, const struct cred *old); |
1557 | void (*cred_transfer)(struct cred *new, const struct cred *old); | ||
1490 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1558 | int (*kernel_act_as)(struct cred *new, u32 secid); |
1491 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1559 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
1560 | int (*kernel_module_request)(void); | ||
1492 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); | 1561 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); |
1493 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, | 1562 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
1494 | int flags); | 1563 | int flags); |
@@ -1556,6 +1625,10 @@ struct security_operations { | |||
1556 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); | 1625 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
1557 | void (*release_secctx) (char *secdata, u32 seclen); | 1626 | void (*release_secctx) (char *secdata, u32 seclen); |
1558 | 1627 | ||
1628 | int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen); | ||
1629 | int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen); | ||
1630 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); | ||
1631 | |||
1559 | #ifdef CONFIG_SECURITY_NETWORK | 1632 | #ifdef CONFIG_SECURITY_NETWORK |
1560 | int (*unix_stream_connect) (struct socket *sock, | 1633 | int (*unix_stream_connect) (struct socket *sock, |
1561 | struct socket *other, struct sock *newsk); | 1634 | struct socket *other, struct sock *newsk); |
@@ -1592,6 +1665,9 @@ struct security_operations { | |||
1592 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); | 1665 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); |
1593 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); | 1666 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); |
1594 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); | 1667 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); |
1668 | int (*tun_dev_create)(void); | ||
1669 | void (*tun_dev_post_create)(struct sock *sk); | ||
1670 | int (*tun_dev_attach)(struct sock *sk); | ||
1595 | #endif /* CONFIG_SECURITY_NETWORK */ | 1671 | #endif /* CONFIG_SECURITY_NETWORK */ |
1596 | 1672 | ||
1597 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1673 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
@@ -1620,6 +1696,9 @@ struct security_operations { | |||
1620 | const struct cred *cred, | 1696 | const struct cred *cred, |
1621 | key_perm_t perm); | 1697 | key_perm_t perm); |
1622 | int (*key_getsecurity)(struct key *key, char **_buffer); | 1698 | int (*key_getsecurity)(struct key *key, char **_buffer); |
1699 | int (*key_session_to_parent)(const struct cred *cred, | ||
1700 | const struct cred *parent_cred, | ||
1701 | struct key *key); | ||
1623 | #endif /* CONFIG_KEYS */ | 1702 | #endif /* CONFIG_KEYS */ |
1624 | 1703 | ||
1625 | #ifdef CONFIG_AUDIT | 1704 | #ifdef CONFIG_AUDIT |
@@ -1637,7 +1716,7 @@ extern int security_module_enable(struct security_operations *ops); | |||
1637 | extern int register_security(struct security_operations *ops); | 1716 | extern int register_security(struct security_operations *ops); |
1638 | 1717 | ||
1639 | /* Security operations */ | 1718 | /* Security operations */ |
1640 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); | 1719 | int security_ptrace_access_check(struct task_struct *child, unsigned int mode); |
1641 | int security_ptrace_traceme(struct task_struct *parent); | 1720 | int security_ptrace_traceme(struct task_struct *parent); |
1642 | int security_capget(struct task_struct *target, | 1721 | int security_capget(struct task_struct *target, |
1643 | kernel_cap_t *effective, | 1722 | kernel_cap_t *effective, |
@@ -1736,11 +1815,14 @@ int security_file_send_sigiotask(struct task_struct *tsk, | |||
1736 | int security_file_receive(struct file *file); | 1815 | int security_file_receive(struct file *file); |
1737 | int security_dentry_open(struct file *file, const struct cred *cred); | 1816 | int security_dentry_open(struct file *file, const struct cred *cred); |
1738 | int security_task_create(unsigned long clone_flags); | 1817 | int security_task_create(unsigned long clone_flags); |
1818 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); | ||
1739 | void security_cred_free(struct cred *cred); | 1819 | void security_cred_free(struct cred *cred); |
1740 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); | 1820 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); |
1741 | void security_commit_creds(struct cred *new, const struct cred *old); | 1821 | void security_commit_creds(struct cred *new, const struct cred *old); |
1822 | void security_transfer_creds(struct cred *new, const struct cred *old); | ||
1742 | int security_kernel_act_as(struct cred *new, u32 secid); | 1823 | int security_kernel_act_as(struct cred *new, u32 secid); |
1743 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 1824 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
1825 | int security_kernel_module_request(void); | ||
1744 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); | 1826 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); |
1745 | int security_task_fix_setuid(struct cred *new, const struct cred *old, | 1827 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
1746 | int flags); | 1828 | int flags); |
@@ -1796,6 +1878,9 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | |||
1796 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 1878 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
1797 | void security_release_secctx(char *secdata, u32 seclen); | 1879 | void security_release_secctx(char *secdata, u32 seclen); |
1798 | 1880 | ||
1881 | int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); | ||
1882 | int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); | ||
1883 | int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); | ||
1799 | #else /* CONFIG_SECURITY */ | 1884 | #else /* CONFIG_SECURITY */ |
1800 | struct security_mnt_opts { | 1885 | struct security_mnt_opts { |
1801 | }; | 1886 | }; |
@@ -1818,10 +1903,10 @@ static inline int security_init(void) | |||
1818 | return 0; | 1903 | return 0; |
1819 | } | 1904 | } |
1820 | 1905 | ||
1821 | static inline int security_ptrace_may_access(struct task_struct *child, | 1906 | static inline int security_ptrace_access_check(struct task_struct *child, |
1822 | unsigned int mode) | 1907 | unsigned int mode) |
1823 | { | 1908 | { |
1824 | return cap_ptrace_may_access(child, mode); | 1909 | return cap_ptrace_access_check(child, mode); |
1825 | } | 1910 | } |
1826 | 1911 | ||
1827 | static inline int security_ptrace_traceme(struct task_struct *parent) | 1912 | static inline int security_ptrace_traceme(struct task_struct *parent) |
@@ -2266,6 +2351,11 @@ static inline int security_task_create(unsigned long clone_flags) | |||
2266 | return 0; | 2351 | return 0; |
2267 | } | 2352 | } |
2268 | 2353 | ||
2354 | static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) | ||
2355 | { | ||
2356 | return 0; | ||
2357 | } | ||
2358 | |||
2269 | static inline void security_cred_free(struct cred *cred) | 2359 | static inline void security_cred_free(struct cred *cred) |
2270 | { } | 2360 | { } |
2271 | 2361 | ||
@@ -2281,6 +2371,11 @@ static inline void security_commit_creds(struct cred *new, | |||
2281 | { | 2371 | { |
2282 | } | 2372 | } |
2283 | 2373 | ||
2374 | static inline void security_transfer_creds(struct cred *new, | ||
2375 | const struct cred *old) | ||
2376 | { | ||
2377 | } | ||
2378 | |||
2284 | static inline int security_kernel_act_as(struct cred *cred, u32 secid) | 2379 | static inline int security_kernel_act_as(struct cred *cred, u32 secid) |
2285 | { | 2380 | { |
2286 | return 0; | 2381 | return 0; |
@@ -2292,6 +2387,11 @@ static inline int security_kernel_create_files_as(struct cred *cred, | |||
2292 | return 0; | 2387 | return 0; |
2293 | } | 2388 | } |
2294 | 2389 | ||
2390 | static inline int security_kernel_module_request(void) | ||
2391 | { | ||
2392 | return 0; | ||
2393 | } | ||
2394 | |||
2295 | static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, | 2395 | static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, |
2296 | int flags) | 2396 | int flags) |
2297 | { | 2397 | { |
@@ -2537,6 +2637,19 @@ static inline int security_secctx_to_secid(const char *secdata, | |||
2537 | static inline void security_release_secctx(char *secdata, u32 seclen) | 2637 | static inline void security_release_secctx(char *secdata, u32 seclen) |
2538 | { | 2638 | { |
2539 | } | 2639 | } |
2640 | |||
2641 | static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) | ||
2642 | { | ||
2643 | return -EOPNOTSUPP; | ||
2644 | } | ||
2645 | static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) | ||
2646 | { | ||
2647 | return -EOPNOTSUPP; | ||
2648 | } | ||
2649 | static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen) | ||
2650 | { | ||
2651 | return -EOPNOTSUPP; | ||
2652 | } | ||
2540 | #endif /* CONFIG_SECURITY */ | 2653 | #endif /* CONFIG_SECURITY */ |
2541 | 2654 | ||
2542 | #ifdef CONFIG_SECURITY_NETWORK | 2655 | #ifdef CONFIG_SECURITY_NETWORK |
@@ -2575,6 +2688,9 @@ void security_inet_csk_clone(struct sock *newsk, | |||
2575 | const struct request_sock *req); | 2688 | const struct request_sock *req); |
2576 | void security_inet_conn_established(struct sock *sk, | 2689 | void security_inet_conn_established(struct sock *sk, |
2577 | struct sk_buff *skb); | 2690 | struct sk_buff *skb); |
2691 | int security_tun_dev_create(void); | ||
2692 | void security_tun_dev_post_create(struct sock *sk); | ||
2693 | int security_tun_dev_attach(struct sock *sk); | ||
2578 | 2694 | ||
2579 | #else /* CONFIG_SECURITY_NETWORK */ | 2695 | #else /* CONFIG_SECURITY_NETWORK */ |
2580 | static inline int security_unix_stream_connect(struct socket *sock, | 2696 | static inline int security_unix_stream_connect(struct socket *sock, |
@@ -2725,6 +2841,20 @@ static inline void security_inet_conn_established(struct sock *sk, | |||
2725 | struct sk_buff *skb) | 2841 | struct sk_buff *skb) |
2726 | { | 2842 | { |
2727 | } | 2843 | } |
2844 | |||
2845 | static inline int security_tun_dev_create(void) | ||
2846 | { | ||
2847 | return 0; | ||
2848 | } | ||
2849 | |||
2850 | static inline void security_tun_dev_post_create(struct sock *sk) | ||
2851 | { | ||
2852 | } | ||
2853 | |||
2854 | static inline int security_tun_dev_attach(struct sock *sk) | ||
2855 | { | ||
2856 | return 0; | ||
2857 | } | ||
2728 | #endif /* CONFIG_SECURITY_NETWORK */ | 2858 | #endif /* CONFIG_SECURITY_NETWORK */ |
2729 | 2859 | ||
2730 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 2860 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
@@ -2881,6 +3011,9 @@ void security_key_free(struct key *key); | |||
2881 | int security_key_permission(key_ref_t key_ref, | 3011 | int security_key_permission(key_ref_t key_ref, |
2882 | const struct cred *cred, key_perm_t perm); | 3012 | const struct cred *cred, key_perm_t perm); |
2883 | int security_key_getsecurity(struct key *key, char **_buffer); | 3013 | int security_key_getsecurity(struct key *key, char **_buffer); |
3014 | int security_key_session_to_parent(const struct cred *cred, | ||
3015 | const struct cred *parent_cred, | ||
3016 | struct key *key); | ||
2884 | 3017 | ||
2885 | #else | 3018 | #else |
2886 | 3019 | ||
@@ -2908,6 +3041,13 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer) | |||
2908 | return 0; | 3041 | return 0; |
2909 | } | 3042 | } |
2910 | 3043 | ||
3044 | static inline int security_key_session_to_parent(const struct cred *cred, | ||
3045 | const struct cred *parent_cred, | ||
3046 | struct key *key) | ||
3047 | { | ||
3048 | return 0; | ||
3049 | } | ||
3050 | |||
2911 | #endif | 3051 | #endif |
2912 | #endif /* CONFIG_KEYS */ | 3052 | #endif /* CONFIG_KEYS */ |
2913 | 3053 | ||
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index abff6c9b413c..6d3f2f449ead 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -39,7 +39,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | |||
39 | } | 39 | } |
40 | 40 | ||
41 | #ifdef CONFIG_TMPFS_POSIX_ACL | 41 | #ifdef CONFIG_TMPFS_POSIX_ACL |
42 | int shmem_permission(struct inode *, int); | 42 | int shmem_check_acl(struct inode *, int); |
43 | int shmem_acl_init(struct inode *, struct inode *); | 43 | int shmem_acl_init(struct inode *, struct inode *); |
44 | 44 | ||
45 | extern struct xattr_handler shmem_xattr_acl_access_handler; | 45 | extern struct xattr_handler shmem_xattr_acl_access_handler; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index e8c6c9136c97..0d3974f59c53 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
26 | #define NR_LDISCS 19 | 26 | #define NR_LDISCS 20 |
27 | 27 | ||
28 | /* line disciplines */ | 28 | /* line disciplines */ |
29 | #define N_TTY 0 | 29 | #define N_TTY 0 |
@@ -47,6 +47,8 @@ | |||
47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ | 47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ |
48 | #define N_PPS 18 /* Pulse per Second */ | 48 | #define N_PPS 18 /* Pulse per Second */ |
49 | 49 | ||
50 | #define N_V253 19 /* Codec control over voice modem */ | ||
51 | |||
50 | /* | 52 | /* |
51 | * This character is the same as _POSIX_VDISABLE: it cannot be used as | 53 | * This character is the same as _POSIX_VDISABLE: it cannot be used as |
52 | * a c_cc[] character, but indicates that a particular special character | 54 | * a c_cc[] character, but indicates that a particular special character |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 13e1adf55c4c..6273fa97b527 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -240,6 +240,21 @@ static inline int cancel_delayed_work(struct delayed_work *work) | |||
240 | return ret; | 240 | return ret; |
241 | } | 241 | } |
242 | 242 | ||
243 | /* | ||
244 | * Like above, but uses del_timer() instead of del_timer_sync(). This means, | ||
245 | * if it returns 0 the timer function may be running and the queueing is in | ||
246 | * progress. | ||
247 | */ | ||
248 | static inline int __cancel_delayed_work(struct delayed_work *work) | ||
249 | { | ||
250 | int ret; | ||
251 | |||
252 | ret = del_timer(&work->timer); | ||
253 | if (ret) | ||
254 | work_clear_pending(&work->work); | ||
255 | return ret; | ||
256 | } | ||
257 | |||
243 | extern int cancel_delayed_work_sync(struct delayed_work *work); | 258 | extern int cancel_delayed_work_sync(struct delayed_work *work); |
244 | 259 | ||
245 | /* Obsolete. use cancel_delayed_work_sync() */ | 260 | /* Obsolete. use cancel_delayed_work_sync() */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 3224820c8514..78b1e4684cc9 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -14,17 +14,6 @@ extern struct list_head inode_in_use; | |||
14 | extern struct list_head inode_unused; | 14 | extern struct list_head inode_unused; |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Yes, writeback.h requires sched.h | ||
18 | * No, sched.h is not included from here. | ||
19 | */ | ||
20 | static inline int task_is_pdflush(struct task_struct *task) | ||
21 | { | ||
22 | return task->flags & PF_FLUSHER; | ||
23 | } | ||
24 | |||
25 | #define current_is_pdflush() task_is_pdflush(current) | ||
26 | |||
27 | /* | ||
28 | * fs/fs-writeback.c | 17 | * fs/fs-writeback.c |
29 | */ | 18 | */ |
30 | enum writeback_sync_modes { | 19 | enum writeback_sync_modes { |
@@ -40,6 +29,8 @@ enum writeback_sync_modes { | |||
40 | struct writeback_control { | 29 | struct writeback_control { |
41 | struct backing_dev_info *bdi; /* If !NULL, only write back this | 30 | struct backing_dev_info *bdi; /* If !NULL, only write back this |
42 | queue */ | 31 | queue */ |
32 | struct super_block *sb; /* if !NULL, only write inodes from | ||
33 | this super_block */ | ||
43 | enum writeback_sync_modes sync_mode; | 34 | enum writeback_sync_modes sync_mode; |
44 | unsigned long *older_than_this; /* If !NULL, only write back inodes | 35 | unsigned long *older_than_this; /* If !NULL, only write back inodes |
45 | older than this */ | 36 | older than this */ |
@@ -76,9 +67,13 @@ struct writeback_control { | |||
76 | /* | 67 | /* |
77 | * fs/fs-writeback.c | 68 | * fs/fs-writeback.c |
78 | */ | 69 | */ |
79 | void writeback_inodes(struct writeback_control *wbc); | 70 | struct bdi_writeback; |
80 | int inode_wait(void *); | 71 | int inode_wait(void *); |
81 | void sync_inodes_sb(struct super_block *, int wait); | 72 | long writeback_inodes_sb(struct super_block *); |
73 | long sync_inodes_sb(struct super_block *); | ||
74 | void writeback_inodes_wbc(struct writeback_control *wbc); | ||
75 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | ||
76 | void wakeup_flusher_threads(long nr_pages); | ||
82 | 77 | ||
83 | /* writeback.h requires fs.h; it, too, is not included from here. */ | 78 | /* writeback.h requires fs.h; it, too, is not included from here. */ |
84 | static inline void wait_on_inode(struct inode *inode) | 79 | static inline void wait_on_inode(struct inode *inode) |
@@ -98,7 +93,6 @@ static inline void inode_sync_wait(struct inode *inode) | |||
98 | /* | 93 | /* |
99 | * mm/page-writeback.c | 94 | * mm/page-writeback.c |
100 | */ | 95 | */ |
101 | int wakeup_pdflush(long nr_pages); | ||
102 | void laptop_io_completion(void); | 96 | void laptop_io_completion(void); |
103 | void laptop_sync_completion(void); | 97 | void laptop_sync_completion(void); |
104 | void throttle_vm_writeout(gfp_t gfp_mask); | 98 | void throttle_vm_writeout(gfp_t gfp_mask); |
@@ -150,7 +144,6 @@ balance_dirty_pages_ratelimited(struct address_space *mapping) | |||
150 | typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, | 144 | typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, |
151 | void *data); | 145 | void *data); |
152 | 146 | ||
153 | int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); | ||
154 | int generic_writepages(struct address_space *mapping, | 147 | int generic_writepages(struct address_space *mapping, |
155 | struct writeback_control *wbc); | 148 | struct writeback_control *wbc); |
156 | int write_cache_pages(struct address_space *mapping, | 149 | int write_cache_pages(struct address_space *mapping, |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index d131e352cfe1..5c84af8c5f6f 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
@@ -49,6 +49,7 @@ struct xattr_handler { | |||
49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); | 49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); |
50 | ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); | 50 | ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); |
51 | ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); | 51 | ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); |
52 | int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int); | ||
52 | int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); | 53 | int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); |
53 | int vfs_removexattr(struct dentry *, const char *); | 54 | int vfs_removexattr(struct dentry *, const char *); |
54 | 55 | ||
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 7eafb8d54470..82a3191375f5 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -61,8 +61,8 @@ psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | struct qdisc_watchdog { | 63 | struct qdisc_watchdog { |
64 | struct tasklet_hrtimer timer; | 64 | struct hrtimer timer; |
65 | struct Qdisc *qdisc; | 65 | struct Qdisc *qdisc; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); | 68 | extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); |
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 251fc1cd5002..3dae3f799b9b 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -32,6 +32,9 @@ | |||
32 | #include "control.h" | 32 | #include "control.h" |
33 | #include "info.h" | 33 | #include "info.h" |
34 | 34 | ||
35 | /* maximum number of devices on the AC97 bus */ | ||
36 | #define AC97_BUS_MAX_DEVICES 4 | ||
37 | |||
35 | /* | 38 | /* |
36 | * AC'97 codec registers | 39 | * AC'97 codec registers |
37 | */ | 40 | */ |
@@ -642,4 +645,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); | |||
642 | /* ad hoc AC97 device driver access */ | 645 | /* ad hoc AC97 device driver access */ |
643 | extern struct bus_type ac97_bus_type; | 646 | extern struct bus_type ac97_bus_type; |
644 | 647 | ||
648 | /* AC97 platform_data adding function */ | ||
649 | static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data) | ||
650 | { | ||
651 | ac97->dev.platform_data = data; | ||
652 | } | ||
653 | |||
645 | #endif /* __SOUND_AC97_CODEC_H */ | 654 | #endif /* __SOUND_AC97_CODEC_H */ |
diff --git a/include/sound/asound.h b/include/sound/asound.h index 82aed3f47534..1f57bb92eb5a 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
@@ -138,7 +138,7 @@ struct snd_hwdep_dsp_image { | |||
138 | * * | 138 | * * |
139 | *****************************************************************************/ | 139 | *****************************************************************************/ |
140 | 140 | ||
141 | #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9) | 141 | #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10) |
142 | 142 | ||
143 | typedef unsigned long snd_pcm_uframes_t; | 143 | typedef unsigned long snd_pcm_uframes_t; |
144 | typedef signed long snd_pcm_sframes_t; | 144 | typedef signed long snd_pcm_sframes_t; |
diff --git a/include/sound/core.h b/include/sound/core.h index 309cb9659a05..a61499c22b0b 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -93,15 +93,6 @@ struct snd_device { | |||
93 | 93 | ||
94 | #define snd_device(n) list_entry(n, struct snd_device, list) | 94 | #define snd_device(n) list_entry(n, struct snd_device, list) |
95 | 95 | ||
96 | /* monitor files for graceful shutdown (hotplug) */ | ||
97 | |||
98 | struct snd_monitor_file { | ||
99 | struct file *file; | ||
100 | const struct file_operations *disconnected_f_op; | ||
101 | struct list_head shutdown_list; /* still need to shutdown */ | ||
102 | struct list_head list; /* link of monitor files */ | ||
103 | }; | ||
104 | |||
105 | /* main structure for soundcard */ | 96 | /* main structure for soundcard */ |
106 | 97 | ||
107 | struct snd_card { | 98 | struct snd_card { |
@@ -311,9 +302,7 @@ int snd_component_add(struct snd_card *card, const char *component); | |||
311 | int snd_card_file_add(struct snd_card *card, struct file *file); | 302 | int snd_card_file_add(struct snd_card *card, struct file *file); |
312 | int snd_card_file_remove(struct snd_card *card, struct file *file); | 303 | int snd_card_file_remove(struct snd_card *card, struct file *file); |
313 | 304 | ||
314 | #ifndef snd_card_set_dev | ||
315 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) | 305 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) |
316 | #endif | ||
317 | 306 | ||
318 | /* device.c */ | 307 | /* device.c */ |
319 | 308 | ||
@@ -340,18 +329,17 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size); | |||
340 | struct resource; | 329 | struct resource; |
341 | void release_and_free_resource(struct resource *res); | 330 | void release_and_free_resource(struct resource *res); |
342 | 331 | ||
343 | #ifdef CONFIG_SND_VERBOSE_PRINTK | ||
344 | void snd_verbose_printk(const char *file, int line, const char *format, ...) | ||
345 | __attribute__ ((format (printf, 3, 4))); | ||
346 | #endif | ||
347 | #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) | ||
348 | void snd_verbose_printd(const char *file, int line, const char *format, ...) | ||
349 | __attribute__ ((format (printf, 3, 4))); | ||
350 | #endif | ||
351 | |||
352 | /* --- */ | 332 | /* --- */ |
353 | 333 | ||
354 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 334 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) |
335 | void __snd_printk(unsigned int level, const char *file, int line, | ||
336 | const char *format, ...) | ||
337 | __attribute__ ((format (printf, 4, 5))); | ||
338 | #else | ||
339 | #define __snd_printk(level, file, line, format, args...) \ | ||
340 | printk(format, ##args) | ||
341 | #endif | ||
342 | |||
355 | /** | 343 | /** |
356 | * snd_printk - printk wrapper | 344 | * snd_printk - printk wrapper |
357 | * @fmt: format string | 345 | * @fmt: format string |
@@ -360,15 +348,9 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
360 | * when configured with CONFIG_SND_VERBOSE_PRINTK. | 348 | * when configured with CONFIG_SND_VERBOSE_PRINTK. |
361 | */ | 349 | */ |
362 | #define snd_printk(fmt, args...) \ | 350 | #define snd_printk(fmt, args...) \ |
363 | snd_verbose_printk(__FILE__, __LINE__, fmt ,##args) | 351 | __snd_printk(0, __FILE__, __LINE__, fmt, ##args) |
364 | #else | ||
365 | #define snd_printk(fmt, args...) \ | ||
366 | printk(fmt ,##args) | ||
367 | #endif | ||
368 | 352 | ||
369 | #ifdef CONFIG_SND_DEBUG | 353 | #ifdef CONFIG_SND_DEBUG |
370 | |||
371 | #ifdef CONFIG_SND_VERBOSE_PRINTK | ||
372 | /** | 354 | /** |
373 | * snd_printd - debug printk | 355 | * snd_printd - debug printk |
374 | * @fmt: format string | 356 | * @fmt: format string |
@@ -377,11 +359,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
377 | * Ignored when CONFIG_SND_DEBUG is not set. | 359 | * Ignored when CONFIG_SND_DEBUG is not set. |
378 | */ | 360 | */ |
379 | #define snd_printd(fmt, args...) \ | 361 | #define snd_printd(fmt, args...) \ |
380 | snd_verbose_printd(__FILE__, __LINE__, fmt ,##args) | 362 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) |
381 | #else | ||
382 | #define snd_printd(fmt, args...) \ | ||
383 | printk(fmt ,##args) | ||
384 | #endif | ||
385 | 363 | ||
386 | /** | 364 | /** |
387 | * snd_BUG - give a BUG warning message and stack trace | 365 | * snd_BUG - give a BUG warning message and stack trace |
@@ -428,9 +406,10 @@ static inline int __snd_bug_on(int cond) | |||
428 | * Works like snd_printk() for debugging purposes. | 406 | * Works like snd_printk() for debugging purposes. |
429 | * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. | 407 | * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. |
430 | */ | 408 | */ |
431 | #define snd_printdd(format, args...) snd_printk(format, ##args) | 409 | #define snd_printdd(format, args...) \ |
410 | __snd_printk(2, __FILE__, __LINE__, format, ##args) | ||
432 | #else | 411 | #else |
433 | #define snd_printdd(format, args...) /* nothing */ | 412 | #define snd_printdd(format, args...) do { } while (0) |
434 | #endif | 413 | #endif |
435 | 414 | ||
436 | 415 | ||
@@ -438,12 +417,10 @@ static inline int __snd_bug_on(int cond) | |||
438 | 417 | ||
439 | /* for easier backward-porting */ | 418 | /* for easier backward-porting */ |
440 | #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) | 419 | #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) |
441 | #ifndef gameport_set_dev_parent | ||
442 | #define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) | 420 | #define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) |
443 | #define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) | 421 | #define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) |
444 | #define gameport_get_port_data(gp) (gp)->port_data | 422 | #define gameport_get_port_data(gp) (gp)->port_data |
445 | #endif | 423 | #endif |
446 | #endif | ||
447 | 424 | ||
448 | /* PCI quirk list helper */ | 425 | /* PCI quirk list helper */ |
449 | struct snd_pci_quirk { | 426 | struct snd_pci_quirk { |
diff --git a/include/sound/info.h b/include/sound/info.h index 7c2ee1a21b00..112e8949e1a7 100644 --- a/include/sound/info.h +++ b/include/sound/info.h | |||
@@ -110,13 +110,13 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer); | |||
110 | static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} | 110 | static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \ | 113 | int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \ |
114 | __attribute__ ((format (printf, 2, 3))); | 114 | __attribute__ ((format (printf, 2, 3))); |
115 | int snd_info_init(void); | 115 | int snd_info_init(void); |
116 | int snd_info_done(void); | 116 | int snd_info_done(void); |
117 | 117 | ||
118 | int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len); | 118 | int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len); |
119 | char *snd_info_get_str(char *dest, char *src, int len); | 119 | const char *snd_info_get_str(char *dest, const char *src, int len); |
120 | struct snd_info_entry *snd_info_create_module_entry(struct module *module, | 120 | struct snd_info_entry *snd_info_create_module_entry(struct module *module, |
121 | const char *name, | 121 | const char *name, |
122 | struct snd_info_entry *parent); | 122 | struct snd_info_entry *parent); |
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h index 7ccce94a5255..c42506212649 100644 --- a/include/sound/memalloc.h +++ b/include/sound/memalloc.h | |||
@@ -47,7 +47,11 @@ struct snd_dma_device { | |||
47 | #define SNDRV_DMA_TYPE_UNKNOWN 0 /* not defined */ | 47 | #define SNDRV_DMA_TYPE_UNKNOWN 0 /* not defined */ |
48 | #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ | 48 | #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ |
49 | #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ | 49 | #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ |
50 | #ifdef CONFIG_SND_DMA_SGBUF | ||
50 | #define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ | 51 | #define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ |
52 | #else | ||
53 | #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ | ||
54 | #endif | ||
51 | 55 | ||
52 | /* | 56 | /* |
53 | * info for buffer allocation | 57 | * info for buffer allocation |
@@ -60,6 +64,7 @@ struct snd_dma_buffer { | |||
60 | void *private_data; /* private for allocator; don't touch */ | 64 | void *private_data; /* private for allocator; don't touch */ |
61 | }; | 65 | }; |
62 | 66 | ||
67 | #ifdef CONFIG_SND_DMA_SGBUF | ||
63 | /* | 68 | /* |
64 | * Scatter-Gather generic device pages | 69 | * Scatter-Gather generic device pages |
65 | */ | 70 | */ |
@@ -107,6 +112,7 @@ static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) | |||
107 | { | 112 | { |
108 | return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; | 113 | return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; |
109 | } | 114 | } |
115 | #endif /* CONFIG_SND_DMA_SGBUF */ | ||
110 | 116 | ||
111 | /* allocate/release a buffer */ | 117 | /* allocate/release a buffer */ |
112 | int snd_dma_alloc_pages(int type, struct device *dev, size_t size, | 118 | int snd_dma_alloc_pages(int type, struct device *dev, size_t size, |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 23893523dc8c..de6d981de5d6 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -902,6 +902,7 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, | |||
902 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); | 902 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); |
903 | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); | 903 | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); |
904 | 904 | ||
905 | #ifdef CONFIG_SND_DMA_SGBUF | ||
905 | /* | 906 | /* |
906 | * SG-buffer handling | 907 | * SG-buffer handling |
907 | */ | 908 | */ |
@@ -927,6 +928,28 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, | |||
927 | unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, | 928 | unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, |
928 | unsigned int ofs, unsigned int size); | 929 | unsigned int ofs, unsigned int size); |
929 | 930 | ||
931 | #else /* !SND_DMA_SGBUF */ | ||
932 | /* | ||
933 | * fake using a continuous buffer | ||
934 | */ | ||
935 | static inline dma_addr_t | ||
936 | snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) | ||
937 | { | ||
938 | return substream->runtime->dma_addr + ofs; | ||
939 | } | ||
940 | |||
941 | static inline void * | ||
942 | snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) | ||
943 | { | ||
944 | return substream->runtime->dma_area + ofs; | ||
945 | } | ||
946 | |||
947 | #define snd_pcm_sgbuf_ops_page NULL | ||
948 | |||
949 | #define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) | ||
950 | |||
951 | #endif /* SND_DMA_SGBUF */ | ||
952 | |||
930 | /* handle mmap counter - PCM mmap callback should handle this counter properly */ | 953 | /* handle mmap counter - PCM mmap callback should handle this counter properly */ |
931 | static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) | 954 | static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) |
932 | { | 955 | { |
@@ -965,4 +988,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) | |||
965 | 988 | ||
966 | #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) | 989 | #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) |
967 | 990 | ||
991 | const char *snd_pcm_format_name(snd_pcm_format_t format); | ||
992 | |||
968 | #endif /* __SOUND_PCM_H */ | 993 | #endif /* __SOUND_PCM_H */ |
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h new file mode 100644 index 000000000000..c0227361a876 --- /dev/null +++ b/include/sound/sh_fsi.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef __SOUND_FSI_H | ||
2 | #define __SOUND_FSI_H | ||
3 | |||
4 | /* | ||
5 | * Fifo-attached Serial Interface (FSI) support for SH7724 | ||
6 | * | ||
7 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
8 | * Kuninori Morimoto <morimoto.kuninori@renesas.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 | /* flags format | ||
16 | |||
17 | * 0xABCDEEFF | ||
18 | * | ||
19 | * A: channel size for TDM (input) | ||
20 | * B: channel size for TDM (ooutput) | ||
21 | * C: inversion | ||
22 | * D: mode | ||
23 | * E: input format | ||
24 | * F: output format | ||
25 | */ | ||
26 | |||
27 | #include <linux/clk.h> | ||
28 | #include <sound/soc.h> | ||
29 | |||
30 | /* TDM channel */ | ||
31 | #define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28) | ||
32 | #define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24) | ||
33 | |||
34 | #define SH_FSI_CH_IMASK 0xF0000000 | ||
35 | #define SH_FSI_CH_OMASK 0x0F000000 | ||
36 | #define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28) | ||
37 | #define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24) | ||
38 | |||
39 | /* clock inversion */ | ||
40 | #define SH_FSI_INVERSION_MASK 0x00F00000 | ||
41 | #define SH_FSI_LRM_INV (1 << 20) | ||
42 | #define SH_FSI_BRM_INV (1 << 21) | ||
43 | #define SH_FSI_LRS_INV (1 << 22) | ||
44 | #define SH_FSI_BRS_INV (1 << 23) | ||
45 | |||
46 | /* mode */ | ||
47 | #define SH_FSI_MODE_MASK 0x000F0000 | ||
48 | #define SH_FSI_IN_SLAVE_MODE (1 << 16) /* default master mode */ | ||
49 | #define SH_FSI_OUT_SLAVE_MODE (1 << 17) /* default master mode */ | ||
50 | |||
51 | /* DI format */ | ||
52 | #define SH_FSI_FMT_MASK 0x000000FF | ||
53 | #define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8) | ||
54 | #define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0) | ||
55 | #define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK) | ||
56 | #define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK) | ||
57 | |||
58 | #define SH_FSI_FMT_MONO (1 << 0) | ||
59 | #define SH_FSI_FMT_MONO_DELAY (1 << 1) | ||
60 | #define SH_FSI_FMT_PCM (1 << 2) | ||
61 | #define SH_FSI_FMT_I2S (1 << 3) | ||
62 | #define SH_FSI_FMT_TDM (1 << 4) | ||
63 | #define SH_FSI_FMT_TDM_DELAY (1 << 5) | ||
64 | |||
65 | #define SH_FSI_IFMT_TDM_CH(x) \ | ||
66 | (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x)) | ||
67 | #define SH_FSI_IFMT_TDM_DELAY_CH(x) \ | ||
68 | (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x)) | ||
69 | |||
70 | #define SH_FSI_OFMT_TDM_CH(x) \ | ||
71 | (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x)) | ||
72 | #define SH_FSI_OFMT_TDM_DELAY_CH(x) \ | ||
73 | (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x)) | ||
74 | |||
75 | struct sh_fsi_platform_info { | ||
76 | unsigned long porta_flags; | ||
77 | unsigned long portb_flags; | ||
78 | }; | ||
79 | |||
80 | extern struct snd_soc_dai fsi_soc_dai[2]; | ||
81 | extern struct snd_soc_platform fsi_soc_platform; | ||
82 | |||
83 | #endif /* __SOUND_FSI_H */ | ||
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 352d7eee9b6d..97ca9af414dc 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -27,8 +27,8 @@ struct snd_pcm_substream; | |||
27 | #define SND_SOC_DAIFMT_I2S 0 /* I2S mode */ | 27 | #define SND_SOC_DAIFMT_I2S 0 /* I2S mode */ |
28 | #define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */ | 28 | #define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */ |
29 | #define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */ | 29 | #define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */ |
30 | #define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM LRC */ | 30 | #define SND_SOC_DAIFMT_DSP_A 3 /* L data MSB after FRM LRC */ |
31 | #define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM LRC */ | 31 | #define SND_SOC_DAIFMT_DSP_B 4 /* L data MSB during FRM LRC */ |
32 | #define SND_SOC_DAIFMT_AC97 5 /* AC97 */ | 32 | #define SND_SOC_DAIFMT_AC97 5 /* AC97 */ |
33 | 33 | ||
34 | /* left and right justified also known as MSB and LSB respectively */ | 34 | /* left and right justified also known as MSB and LSB respectively */ |
@@ -38,7 +38,7 @@ struct snd_pcm_substream; | |||
38 | /* | 38 | /* |
39 | * DAI Clock gating. | 39 | * DAI Clock gating. |
40 | * | 40 | * |
41 | * DAI bit clocks can be be gated (disabled) when not the DAI is not | 41 | * DAI bit clocks can be be gated (disabled) when the DAI is not |
42 | * sending or receiving PCM data in a frame. This can be used to save power. | 42 | * sending or receiving PCM data in a frame. This can be used to save power. |
43 | */ | 43 | */ |
44 | #define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */ | 44 | #define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */ |
@@ -51,21 +51,21 @@ struct snd_pcm_substream; | |||
51 | * format. | 51 | * format. |
52 | */ | 52 | */ |
53 | #define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ | 53 | #define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ |
54 | #define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ | 54 | #define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal BCLK + inv FRM */ |
55 | #define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ | 55 | #define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert BCLK + nor FRM */ |
56 | #define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ | 56 | #define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert BCLK + FRM */ |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * DAI hardware clock masters. | 59 | * DAI hardware clock masters. |
60 | * | 60 | * |
61 | * This is wrt the codec, the inverse is true for the interface | 61 | * This is wrt the codec, the inverse is true for the interface |
62 | * i.e. if the codec is clk and frm master then the interface is | 62 | * i.e. if the codec is clk and FRM master then the interface is |
63 | * clk and frame slave. | 63 | * clk and frame slave. |
64 | */ | 64 | */ |
65 | #define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */ | 65 | #define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & FRM master */ |
66 | #define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */ | 66 | #define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & FRM master */ |
67 | #define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */ | 67 | #define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */ |
68 | #define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */ | 68 | #define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & FRM slave */ |
69 | 69 | ||
70 | #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f | 70 | #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f |
71 | #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 | 71 | #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 |
@@ -78,7 +78,13 @@ struct snd_pcm_substream; | |||
78 | #define SND_SOC_CLOCK_IN 0 | 78 | #define SND_SOC_CLOCK_IN 0 |
79 | #define SND_SOC_CLOCK_OUT 1 | 79 | #define SND_SOC_CLOCK_OUT 1 |
80 | 80 | ||
81 | #define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\ | 81 | #define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S8 |\ |
82 | SNDRV_PCM_FMTBIT_S16_LE |\ | ||
83 | SNDRV_PCM_FMTBIT_S16_BE |\ | ||
84 | SNDRV_PCM_FMTBIT_S20_3LE |\ | ||
85 | SNDRV_PCM_FMTBIT_S20_3BE |\ | ||
86 | SNDRV_PCM_FMTBIT_S24_3LE |\ | ||
87 | SNDRV_PCM_FMTBIT_S24_3BE |\ | ||
82 | SNDRV_PCM_FMTBIT_S32_LE |\ | 88 | SNDRV_PCM_FMTBIT_S32_LE |\ |
83 | SNDRV_PCM_FMTBIT_S32_BE) | 89 | SNDRV_PCM_FMTBIT_S32_BE) |
84 | 90 | ||
@@ -106,7 +112,7 @@ int snd_soc_dai_set_pll(struct snd_soc_dai *dai, | |||
106 | int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); | 112 | int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); |
107 | 113 | ||
108 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, | 114 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, |
109 | unsigned int mask, int slots); | 115 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); |
110 | 116 | ||
111 | int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); | 117 | int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); |
112 | 118 | ||
@@ -116,12 +122,12 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); | |||
116 | /* | 122 | /* |
117 | * Digital Audio Interface. | 123 | * Digital Audio Interface. |
118 | * | 124 | * |
119 | * Describes the Digital Audio Interface in terms of it's ALSA, DAI and AC97 | 125 | * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97 |
120 | * operations an capabilities. Codec and platfom drivers will register a this | 126 | * operations and capabilities. Codec and platform drivers will register this |
121 | * structure for every DAI they have. | 127 | * structure for every DAI they have. |
122 | * | 128 | * |
123 | * This structure covers the clocking, formating and ALSA operations for each | 129 | * This structure covers the clocking, formating and ALSA operations for each |
124 | * interface a | 130 | * interface. |
125 | */ | 131 | */ |
126 | struct snd_soc_dai_ops { | 132 | struct snd_soc_dai_ops { |
127 | /* | 133 | /* |
@@ -140,7 +146,8 @@ struct snd_soc_dai_ops { | |||
140 | */ | 146 | */ |
141 | int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); | 147 | int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); |
142 | int (*set_tdm_slot)(struct snd_soc_dai *dai, | 148 | int (*set_tdm_slot)(struct snd_soc_dai *dai, |
143 | unsigned int mask, int slots); | 149 | unsigned int tx_mask, unsigned int rx_mask, |
150 | int slots, int slot_width); | ||
144 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); | 151 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); |
145 | 152 | ||
146 | /* | 153 | /* |
@@ -179,6 +186,7 @@ struct snd_soc_dai { | |||
179 | int ac97_control; | 186 | int ac97_control; |
180 | 187 | ||
181 | struct device *dev; | 188 | struct device *dev; |
189 | void *ac97_pdata; /* platform_data for the ac97 codec */ | ||
182 | 190 | ||
183 | /* DAI callbacks */ | 191 | /* DAI callbacks */ |
184 | int (*probe)(struct platform_device *pdev, | 192 | int (*probe)(struct platform_device *pdev, |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index ec8a45f9a069..c1410e3191e3 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -137,6 +137,12 @@ | |||
137 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} | 137 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} |
138 | 138 | ||
139 | /* stream domain */ | 139 | /* stream domain */ |
140 | #define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \ | ||
141 | { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ | ||
142 | .reg = wreg, .shift = wshift, .invert = winvert } | ||
143 | #define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \ | ||
144 | { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ | ||
145 | .reg = wreg, .shift = wshift, .invert = winvert } | ||
140 | #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ | 146 | #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ |
141 | { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ | 147 | { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ |
142 | .shift = wshift, .invert = winvert} | 148 | .shift = wshift, .invert = winvert} |
@@ -279,9 +285,11 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, | |||
279 | /* dapm events */ | 285 | /* dapm events */ |
280 | int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, | 286 | int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, |
281 | int event); | 287 | int event); |
288 | void snd_soc_dapm_shutdown(struct snd_soc_device *socdev); | ||
282 | 289 | ||
283 | /* dapm sys fs - used by the core */ | 290 | /* dapm sys fs - used by the core */ |
284 | int snd_soc_dapm_sys_add(struct device *dev); | 291 | int snd_soc_dapm_sys_add(struct device *dev); |
292 | void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec); | ||
285 | 293 | ||
286 | /* dapm audio pin control and status */ | 294 | /* dapm audio pin control and status */ |
287 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); | 295 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); |
@@ -311,6 +319,8 @@ enum snd_soc_dapm_type { | |||
311 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ | 319 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ |
312 | snd_soc_dapm_post, /* machine specific post widget - exec last */ | 320 | snd_soc_dapm_post, /* machine specific post widget - exec last */ |
313 | snd_soc_dapm_supply, /* power/clock supply */ | 321 | snd_soc_dapm_supply, /* power/clock supply */ |
322 | snd_soc_dapm_aif_in, /* audio interface input */ | ||
323 | snd_soc_dapm_aif_out, /* audio interface output */ | ||
314 | }; | 324 | }; |
315 | 325 | ||
316 | /* | 326 | /* |
diff --git a/include/sound/soc.h b/include/sound/soc.h index cf6111d72b17..475cb7ed6bec 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -135,6 +135,28 @@ | |||
135 | .info = snd_soc_info_volsw, \ | 135 | .info = snd_soc_info_volsw, \ |
136 | .get = xhandler_get, .put = xhandler_put, \ | 136 | .get = xhandler_get, .put = xhandler_put, \ |
137 | .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } | 137 | .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } |
138 | #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\ | ||
139 | xhandler_get, xhandler_put, tlv_array) \ | ||
140 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
141 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
142 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
143 | .tlv.p = (tlv_array), \ | ||
144 | .info = snd_soc_info_volsw, \ | ||
145 | .get = xhandler_get, .put = xhandler_put, \ | ||
146 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
147 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ | ||
148 | .max = xmax, .invert = xinvert} } | ||
149 | #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ | ||
150 | xhandler_get, xhandler_put, tlv_array) \ | ||
151 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
152 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
153 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
154 | .tlv.p = (tlv_array), \ | ||
155 | .info = snd_soc_info_volsw_2r, \ | ||
156 | .get = xhandler_get, .put = xhandler_put, \ | ||
157 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
158 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | ||
159 | .max = xmax, .invert = xinvert} } | ||
138 | #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ | 160 | #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ |
139 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 161 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
140 | .info = snd_soc_info_bool_ext, \ | 162 | .info = snd_soc_info_bool_ext, \ |
@@ -183,14 +205,28 @@ struct snd_soc_jack_gpio; | |||
183 | #endif | 205 | #endif |
184 | 206 | ||
185 | typedef int (*hw_write_t)(void *,const char* ,int); | 207 | typedef int (*hw_write_t)(void *,const char* ,int); |
186 | typedef int (*hw_read_t)(void *,char* ,int); | ||
187 | 208 | ||
188 | extern struct snd_ac97_bus_ops soc_ac97_ops; | 209 | extern struct snd_ac97_bus_ops soc_ac97_ops; |
189 | 210 | ||
211 | enum snd_soc_control_type { | ||
212 | SND_SOC_CUSTOM, | ||
213 | SND_SOC_I2C, | ||
214 | SND_SOC_SPI, | ||
215 | }; | ||
216 | |||
190 | int snd_soc_register_platform(struct snd_soc_platform *platform); | 217 | int snd_soc_register_platform(struct snd_soc_platform *platform); |
191 | void snd_soc_unregister_platform(struct snd_soc_platform *platform); | 218 | void snd_soc_unregister_platform(struct snd_soc_platform *platform); |
192 | int snd_soc_register_codec(struct snd_soc_codec *codec); | 219 | int snd_soc_register_codec(struct snd_soc_codec *codec); |
193 | void snd_soc_unregister_codec(struct snd_soc_codec *codec); | 220 | void snd_soc_unregister_codec(struct snd_soc_codec *codec); |
221 | int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); | ||
222 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | ||
223 | int addr_bits, int data_bits, | ||
224 | enum snd_soc_control_type control); | ||
225 | |||
226 | #ifdef CONFIG_PM | ||
227 | int snd_soc_suspend_device(struct device *dev); | ||
228 | int snd_soc_resume_device(struct device *dev); | ||
229 | #endif | ||
194 | 230 | ||
195 | /* pcm <-> DAI connect */ | 231 | /* pcm <-> DAI connect */ |
196 | void snd_soc_free_pcms(struct snd_soc_device *socdev); | 232 | void snd_soc_free_pcms(struct snd_soc_device *socdev); |
@@ -216,9 +252,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, | |||
216 | 252 | ||
217 | /* codec register bit access */ | 253 | /* codec register bit access */ |
218 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, | 254 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, |
219 | unsigned short mask, unsigned short value); | 255 | unsigned int mask, unsigned int value); |
220 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, | 256 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, |
221 | unsigned short mask, unsigned short value); | 257 | unsigned int mask, unsigned int value); |
222 | 258 | ||
223 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, | 259 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, |
224 | struct snd_ac97_bus_ops *ops, int num); | 260 | struct snd_ac97_bus_ops *ops, int num); |
@@ -356,8 +392,10 @@ struct snd_soc_codec { | |||
356 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); | 392 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); |
357 | int (*display_register)(struct snd_soc_codec *, char *, | 393 | int (*display_register)(struct snd_soc_codec *, char *, |
358 | size_t, unsigned int); | 394 | size_t, unsigned int); |
395 | int (*volatile_register)(unsigned int); | ||
396 | int (*readable_register)(unsigned int); | ||
359 | hw_write_t hw_write; | 397 | hw_write_t hw_write; |
360 | hw_read_t hw_read; | 398 | unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); |
361 | void *reg_cache; | 399 | void *reg_cache; |
362 | short reg_cache_size; | 400 | short reg_cache_size; |
363 | short reg_cache_step; | 401 | short reg_cache_step; |
@@ -369,8 +407,6 @@ struct snd_soc_codec { | |||
369 | enum snd_soc_bias_level bias_level; | 407 | enum snd_soc_bias_level bias_level; |
370 | enum snd_soc_bias_level suspend_bias_level; | 408 | enum snd_soc_bias_level suspend_bias_level; |
371 | struct delayed_work delayed_work; | 409 | struct delayed_work delayed_work; |
372 | struct list_head up_list; | ||
373 | struct list_head down_list; | ||
374 | 410 | ||
375 | /* codec DAI's */ | 411 | /* codec DAI's */ |
376 | struct snd_soc_dai *dai; | 412 | struct snd_soc_dai *dai; |
@@ -379,6 +415,7 @@ struct snd_soc_codec { | |||
379 | #ifdef CONFIG_DEBUG_FS | 415 | #ifdef CONFIG_DEBUG_FS |
380 | struct dentry *debugfs_reg; | 416 | struct dentry *debugfs_reg; |
381 | struct dentry *debugfs_pop_time; | 417 | struct dentry *debugfs_pop_time; |
418 | struct dentry *debugfs_dapm; | ||
382 | #endif | 419 | #endif |
383 | }; | 420 | }; |
384 | 421 | ||
diff --git a/include/sound/tlv.h b/include/sound/tlv.h index d136ea2181ed..9fd5b19ccf5c 100644 --- a/include/sound/tlv.h +++ b/include/sound/tlv.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ | 35 | #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ |
36 | #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ | 36 | #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ |
37 | #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ | 37 | #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ |
38 | #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ | ||
39 | #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ | ||
38 | 40 | ||
39 | #define TLV_DB_SCALE_ITEM(min, step, mute) \ | 41 | #define TLV_DB_SCALE_ITEM(min, step, mute) \ |
40 | SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \ | 42 | SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \ |
@@ -42,6 +44,18 @@ | |||
42 | #define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ | 44 | #define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ |
43 | unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) } | 45 | unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) } |
44 | 46 | ||
47 | /* dB scale specified with min/max values instead of step */ | ||
48 | #define TLV_DB_MINMAX_ITEM(min_dB, max_dB) \ | ||
49 | SNDRV_CTL_TLVT_DB_MINMAX, 2 * sizeof(unsigned int), \ | ||
50 | (min_dB), (max_dB) | ||
51 | #define TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ | ||
52 | SNDRV_CTL_TLVT_DB_MINMAX_MUTE, 2 * sizeof(unsigned int), \ | ||
53 | (min_dB), (max_dB) | ||
54 | #define DECLARE_TLV_DB_MINMAX(name, min_dB, max_dB) \ | ||
55 | unsigned int name[] = { TLV_DB_MINMAX_ITEM(min_dB, max_dB) } | ||
56 | #define DECLARE_TLV_DB_MINMAX_MUTE(name, min_dB, max_dB) \ | ||
57 | unsigned int name[] = { TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) } | ||
58 | |||
45 | /* linear volume between min_dB and max_dB (.01dB unit) */ | 59 | /* linear volume between min_dB and max_dB (.01dB unit) */ |
46 | #define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \ | 60 | #define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \ |
47 | SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ | 61 | SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ |
diff --git a/include/sound/uda1380.h b/include/sound/uda1380.h new file mode 100644 index 000000000000..381319c7000c --- /dev/null +++ b/include/sound/uda1380.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * UDA1380 ALSA SoC Codec driver | ||
3 | * | ||
4 | * Copyright 2009 Philipp Zabel | ||
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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __UDA1380_H | ||
12 | #define __UDA1380_H | ||
13 | |||
14 | struct uda1380_platform_data { | ||
15 | int gpio_power; | ||
16 | int gpio_reset; | ||
17 | int dac_clk; | ||
18 | #define UDA1380_DAC_CLK_SYSCLK 0 | ||
19 | #define UDA1380_DAC_CLK_WSPLL 1 | ||
20 | }; | ||
21 | |||
22 | #endif /* __UDA1380_H */ | ||
diff --git a/include/sound/version.h b/include/sound/version.h index 456f1359e1c0..22939142dd23 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* include/version.h */ | 1 | /* include/version.h */ |
2 | #define CONFIG_SND_VERSION "1.0.20" | 2 | #define CONFIG_SND_VERSION "1.0.21" |
3 | #define CONFIG_SND_DATE "" | 3 | #define CONFIG_SND_DATE "" |
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h new file mode 100644 index 000000000000..9c661f2f8cda --- /dev/null +++ b/include/sound/wm8993.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * linux/sound/wm8993.h -- Platform data for WM8993 | ||
3 | * | ||
4 | * Copyright 2009 Wolfson Microelectronics. PLC. | ||
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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_SND_WM8993_H | ||
12 | #define __LINUX_SND_WM8993_H | ||
13 | |||
14 | /* Note that EQ1 only contains the enable/disable bit so will be | ||
15 | ignored but is included for simplicity. | ||
16 | */ | ||
17 | struct wm8993_retune_mobile_setting { | ||
18 | const char *name; | ||
19 | unsigned int rate; | ||
20 | u16 config[24]; | ||
21 | }; | ||
22 | |||
23 | struct wm8993_platform_data { | ||
24 | struct wm8993_retune_mobile_setting *retune_configs; | ||
25 | int num_retune_configs; | ||
26 | |||
27 | /* LINEOUT can be differential or single ended */ | ||
28 | unsigned int lineout1_diff:1; | ||
29 | unsigned int lineout2_diff:1; | ||
30 | |||
31 | /* Common mode feedback */ | ||
32 | unsigned int lineout1fb:1; | ||
33 | unsigned int lineout2fb:1; | ||
34 | |||
35 | /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ | ||
36 | unsigned int micbias1_lvl:1; | ||
37 | unsigned int micbias2_lvl:1; | ||
38 | |||
39 | /* Jack detect threashold levels, see datasheet for values */ | ||
40 | unsigned int jd_scthr:2; | ||
41 | unsigned int jd_thr:2; | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h index 05ead6698434..444cd6ba0ba7 100644 --- a/include/sound/ymfpci.h +++ b/include/sound/ymfpci.h | |||
@@ -331,6 +331,7 @@ struct snd_ymfpci { | |||
331 | struct snd_ac97 *ac97; | 331 | struct snd_ac97 *ac97; |
332 | struct snd_rawmidi *rawmidi; | 332 | struct snd_rawmidi *rawmidi; |
333 | struct snd_timer *timer; | 333 | struct snd_timer *timer; |
334 | unsigned int timer_ticks; | ||
334 | 335 | ||
335 | struct pci_dev *pci; | 336 | struct pci_dev *pci; |
336 | struct snd_card *card; | 337 | struct snd_card *card; |