diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-08 07:20:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:35 -0500 |
commit | 4b11111aba6c80cc2969fd1806d2a869bfc9f357 (patch) | |
tree | 57b72a1ca58859dc6a9e47d647f29cebb9bcf7e0 /fs/udf/misc.c | |
parent | bd45a420f93d18c91115f3f0568dd6a2555aa15a (diff) |
udf: fix coding style
fix coding style errors found by checkpatch:
- assignments in if conditions
- braces {} around single statement blocks
- no spaces after commas
- printks without KERN_*
- lines longer than 80 characters
- spaces between "type *" and variable name
before: 192 errors, 561 warnings, 8987 lines checked
after: 1 errors, 38 warnings, 9468 lines checked
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/misc.c')
-rw-r--r-- | fs/udf/misc.c | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 7cecb3098061..a0bf4158f1f1 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c | |||
@@ -70,71 +70,84 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
70 | struct extendedAttrHeaderDesc *eahd; | 70 | struct extendedAttrHeaderDesc *eahd; |
71 | eahd = (struct extendedAttrHeaderDesc *)ea; | 71 | eahd = (struct extendedAttrHeaderDesc *)ea; |
72 | 72 | ||
73 | if (UDF_I_LENALLOC(inode)) { | 73 | if (UDF_I_LENALLOC(inode)) |
74 | memmove(&ad[size], ad, UDF_I_LENALLOC(inode)); | 74 | memmove(&ad[size], ad, UDF_I_LENALLOC(inode)); |
75 | } | ||
76 | 75 | ||
77 | if (UDF_I_LENEATTR(inode)) { | 76 | if (UDF_I_LENEATTR(inode)) { |
78 | /* check checksum/crc */ | 77 | /* check checksum/crc */ |
79 | if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD || | 78 | if (le16_to_cpu(eahd->descTag.tagIdent) != |
80 | le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum) { | 79 | TAG_IDENT_EAHD || |
80 | le32_to_cpu(eahd->descTag.tagLocation) != | ||
81 | UDF_I_LOCATION(inode).logicalBlockNum) | ||
81 | return NULL; | 82 | return NULL; |
82 | } | ||
83 | } else { | 83 | } else { |
84 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 84 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
85 | 85 | ||
86 | size -= sizeof(struct extendedAttrHeaderDesc); | 86 | size -= sizeof(struct extendedAttrHeaderDesc); |
87 | UDF_I_LENEATTR(inode) += sizeof(struct extendedAttrHeaderDesc); | 87 | UDF_I_LENEATTR(inode) += |
88 | sizeof(struct extendedAttrHeaderDesc); | ||
88 | eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD); | 89 | eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD); |
89 | if (sbi->s_udfrev >= 0x0200) | 90 | if (sbi->s_udfrev >= 0x0200) |
90 | eahd->descTag.descVersion = cpu_to_le16(3); | 91 | eahd->descTag.descVersion = cpu_to_le16(3); |
91 | else | 92 | else |
92 | eahd->descTag.descVersion = cpu_to_le16(2); | 93 | eahd->descTag.descVersion = cpu_to_le16(2); |
93 | eahd->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); | 94 | eahd->descTag.tagSerialNum = |
94 | eahd->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum); | 95 | cpu_to_le16(sbi->s_serial_number); |
96 | eahd->descTag.tagLocation = cpu_to_le32( | ||
97 | UDF_I_LOCATION(inode).logicalBlockNum); | ||
95 | eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF); | 98 | eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF); |
96 | eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF); | 99 | eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF); |
97 | } | 100 | } |
98 | 101 | ||
99 | offset = UDF_I_LENEATTR(inode); | 102 | offset = UDF_I_LENEATTR(inode); |
100 | if (type < 2048) { | 103 | if (type < 2048) { |
101 | if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode)) { | 104 | if (le32_to_cpu(eahd->appAttrLocation) < |
102 | uint32_t aal = le32_to_cpu(eahd->appAttrLocation); | 105 | UDF_I_LENEATTR(inode)) { |
106 | uint32_t aal = | ||
107 | le32_to_cpu(eahd->appAttrLocation); | ||
103 | memmove(&ea[offset - aal + size], | 108 | memmove(&ea[offset - aal + size], |
104 | &ea[aal], offset - aal); | 109 | &ea[aal], offset - aal); |
105 | offset -= aal; | 110 | offset -= aal; |
106 | eahd->appAttrLocation = cpu_to_le32(aal + size); | 111 | eahd->appAttrLocation = |
112 | cpu_to_le32(aal + size); | ||
107 | } | 113 | } |
108 | if (le32_to_cpu(eahd->impAttrLocation) < UDF_I_LENEATTR(inode)) { | 114 | if (le32_to_cpu(eahd->impAttrLocation) < |
109 | uint32_t ial = le32_to_cpu(eahd->impAttrLocation); | 115 | UDF_I_LENEATTR(inode)) { |
116 | uint32_t ial = | ||
117 | le32_to_cpu(eahd->impAttrLocation); | ||
110 | memmove(&ea[offset - ial + size], | 118 | memmove(&ea[offset - ial + size], |
111 | &ea[ial], offset - ial); | 119 | &ea[ial], offset - ial); |
112 | offset -= ial; | 120 | offset -= ial; |
113 | eahd->impAttrLocation = cpu_to_le32(ial + size); | 121 | eahd->impAttrLocation = |
122 | cpu_to_le32(ial + size); | ||
114 | } | 123 | } |
115 | } else if (type < 65536) { | 124 | } else if (type < 65536) { |
116 | if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode)) { | 125 | if (le32_to_cpu(eahd->appAttrLocation) < |
117 | uint32_t aal = le32_to_cpu(eahd->appAttrLocation); | 126 | UDF_I_LENEATTR(inode)) { |
127 | uint32_t aal = | ||
128 | le32_to_cpu(eahd->appAttrLocation); | ||
118 | memmove(&ea[offset - aal + size], | 129 | memmove(&ea[offset - aal + size], |
119 | &ea[aal], offset - aal); | 130 | &ea[aal], offset - aal); |
120 | offset -= aal; | 131 | offset -= aal; |
121 | eahd->appAttrLocation = cpu_to_le32(aal + size); | 132 | eahd->appAttrLocation = |
133 | cpu_to_le32(aal + size); | ||
122 | } | 134 | } |
123 | } | 135 | } |
124 | /* rewrite CRC + checksum of eahd */ | 136 | /* rewrite CRC + checksum of eahd */ |
125 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); | 137 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); |
126 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); | 138 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); |
127 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + | 139 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + |
128 | sizeof(tag), crclen, 0)); | 140 | sizeof(tag), crclen, 0)); |
129 | eahd->descTag.tagChecksum = 0; | 141 | eahd->descTag.tagChecksum = 0; |
130 | for (i = 0; i < 16; i++) | 142 | for (i = 0; i < 16; i++) |
131 | if (i != 4) | 143 | if (i != 4) |
132 | eahd->descTag.tagChecksum += ((uint8_t *)&(eahd->descTag))[i]; | 144 | eahd->descTag.tagChecksum += |
145 | ((uint8_t *)&(eahd->descTag))[i]; | ||
133 | UDF_I_LENEATTR(inode) += size; | 146 | UDF_I_LENEATTR(inode) += size; |
134 | return (struct genericFormat *)&ea[offset]; | 147 | return (struct genericFormat *)&ea[offset]; |
135 | } | 148 | } |
136 | if (loc & 0x02) { | 149 | if (loc & 0x02) |
137 | } | 150 | ; |
138 | 151 | ||
139 | return NULL; | 152 | return NULL; |
140 | } | 153 | } |
@@ -153,10 +166,11 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
153 | eahd = (struct extendedAttrHeaderDesc *)ea; | 166 | eahd = (struct extendedAttrHeaderDesc *)ea; |
154 | 167 | ||
155 | /* check checksum/crc */ | 168 | /* check checksum/crc */ |
156 | if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD || | 169 | if (le16_to_cpu(eahd->descTag.tagIdent) != |
157 | le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum) { | 170 | TAG_IDENT_EAHD || |
171 | le32_to_cpu(eahd->descTag.tagLocation) != | ||
172 | UDF_I_LOCATION(inode).logicalBlockNum) | ||
158 | return NULL; | 173 | return NULL; |
159 | } | ||
160 | 174 | ||
161 | if (type < 2048) | 175 | if (type < 2048) |
162 | offset = sizeof(struct extendedAttrHeaderDesc); | 176 | offset = sizeof(struct extendedAttrHeaderDesc); |
@@ -167,7 +181,8 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
167 | 181 | ||
168 | while (offset < UDF_I_LENEATTR(inode)) { | 182 | while (offset < UDF_I_LENEATTR(inode)) { |
169 | gaf = (struct genericFormat *)&ea[offset]; | 183 | gaf = (struct genericFormat *)&ea[offset]; |
170 | if (le32_to_cpu(gaf->attrType) == type && gaf->attrSubtype == subtype) | 184 | if (le32_to_cpu(gaf->attrType) == type && |
185 | gaf->attrSubtype == subtype) | ||
171 | return gaf; | 186 | return gaf; |
172 | else | 187 | else |
173 | offset += le32_to_cpu(gaf->attrLength); | 188 | offset += le32_to_cpu(gaf->attrLength); |
@@ -188,7 +203,7 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
188 | * Written, tested, and released. | 203 | * Written, tested, and released. |
189 | */ | 204 | */ |
190 | struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | 205 | struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, |
191 | uint32_t location, uint16_t * ident) | 206 | uint32_t location, uint16_t *ident) |
192 | { | 207 | { |
193 | tag *tag_p; | 208 | tag *tag_p; |
194 | struct buffer_head *bh = NULL; | 209 | struct buffer_head *bh = NULL; |
@@ -213,7 +228,8 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
213 | 228 | ||
214 | if (location != le32_to_cpu(tag_p->tagLocation)) { | 229 | if (location != le32_to_cpu(tag_p->tagLocation)) { |
215 | udf_debug("location mismatch block %u, tag %u != %u\n", | 230 | udf_debug("location mismatch block %u, tag %u != %u\n", |
216 | block + sbi->s_session, le32_to_cpu(tag_p->tagLocation), location); | 231 | block + sbi->s_session, |
232 | le32_to_cpu(tag_p->tagLocation), location); | ||
217 | goto error_out; | 233 | goto error_out; |
218 | } | 234 | } |
219 | 235 | ||
@@ -239,9 +255,9 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
239 | /* Verify the descriptor CRC */ | 255 | /* Verify the descriptor CRC */ |
240 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || | 256 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || |
241 | le16_to_cpu(tag_p->descCRC) == udf_crc(bh->b_data + sizeof(tag), | 257 | le16_to_cpu(tag_p->descCRC) == udf_crc(bh->b_data + sizeof(tag), |
242 | le16_to_cpu(tag_p->descCRCLength), 0)) { | 258 | le16_to_cpu(tag_p->descCRCLength), 0)) |
243 | return bh; | 259 | return bh; |
244 | } | 260 | |
245 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", | 261 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", |
246 | block + sbi->s_session, le16_to_cpu(tag_p->descCRC), | 262 | block + sbi->s_session, le16_to_cpu(tag_p->descCRC), |
247 | le16_to_cpu(tag_p->descCRCLength)); | 263 | le16_to_cpu(tag_p->descCRCLength)); |
@@ -252,7 +268,7 @@ error_out: | |||
252 | } | 268 | } |
253 | 269 | ||
254 | struct buffer_head *udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, | 270 | struct buffer_head *udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, |
255 | uint32_t offset, uint16_t * ident) | 271 | uint32_t offset, uint16_t *ident) |
256 | { | 272 | { |
257 | return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset), | 273 | return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset), |
258 | loc.logicalBlockNum + offset, ident); | 274 | loc.logicalBlockNum + offset, ident); |