aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2007-07-19 04:47:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:43 -0400
commitcb00ea3528eb3c09eae9871d6e7d038776e952e2 (patch)
treeb87eae0b060f37bedf01b52ccad6034d1df4f376 /fs/udf/file.c
parent95a631e2d9853c9138e14fbaa9a51e6451f040b4 (diff)
UDF: coding style conversion - lindent
This patch converts UDF coding style to kernel coding style using Lindent. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Jan Kara <jack@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c114
1 files changed, 55 insertions, 59 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index df070bee8d4..67bf36bd3e6 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -30,7 +30,7 @@
30#include <linux/udf_fs.h> 30#include <linux/udf_fs.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/string.h> /* memset */ 33#include <linux/string.h> /* memset */
34#include <linux/capability.h> 34#include <linux/capability.h>
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
@@ -41,7 +41,7 @@
41#include "udf_i.h" 41#include "udf_i.h"
42#include "udf_sb.h" 42#include "udf_sb.h"
43 43
44static int udf_adinicb_readpage(struct file *file, struct page * page) 44static int udf_adinicb_readpage(struct file *file, struct page *page)
45{ 45{
46 struct inode *inode = page->mapping->host; 46 struct inode *inode = page->mapping->host;
47 char *kaddr; 47 char *kaddr;
@@ -58,7 +58,8 @@ static int udf_adinicb_readpage(struct file *file, struct page * page)
58 return 0; 58 return 0;
59} 59}
60 60
61static int udf_adinicb_writepage(struct page *page, struct writeback_control *wbc) 61static int udf_adinicb_writepage(struct page *page,
62 struct writeback_control *wbc)
62{ 63{
63 struct inode *inode = page->mapping->host; 64 struct inode *inode = page->mapping->host;
64 char *kaddr; 65 char *kaddr;
@@ -74,19 +75,21 @@ static int udf_adinicb_writepage(struct page *page, struct writeback_control *wb
74 return 0; 75 return 0;
75} 76}
76 77
77static int udf_adinicb_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to) 78static int udf_adinicb_prepare_write(struct file *file, struct page *page,
79 unsigned offset, unsigned to)
78{ 80{
79 kmap(page); 81 kmap(page);
80 return 0; 82 return 0;
81} 83}
82 84
83static int udf_adinicb_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to) 85static int udf_adinicb_commit_write(struct file *file, struct page *page,
86 unsigned offset, unsigned to)
84{ 87{
85 struct inode *inode = page->mapping->host; 88 struct inode *inode = page->mapping->host;
86 char *kaddr = page_address(page); 89 char *kaddr = page_address(page);
87 90
88 memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset, 91 memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset,
89 kaddr + offset, to - offset); 92 kaddr + offset, to - offset);
90 mark_inode_dirty(inode); 93 mark_inode_dirty(inode);
91 SetPageUptodate(page); 94 SetPageUptodate(page);
92 kunmap(page); 95 kunmap(page);
@@ -97,15 +100,15 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page, unsign
97} 100}
98 101
99const struct address_space_operations udf_adinicb_aops = { 102const struct address_space_operations udf_adinicb_aops = {
100 .readpage = udf_adinicb_readpage, 103 .readpage = udf_adinicb_readpage,
101 .writepage = udf_adinicb_writepage, 104 .writepage = udf_adinicb_writepage,
102 .sync_page = block_sync_page, 105 .sync_page = block_sync_page,
103 .prepare_write = udf_adinicb_prepare_write, 106 .prepare_write = udf_adinicb_prepare_write,
104 .commit_write = udf_adinicb_commit_write, 107 .commit_write = udf_adinicb_commit_write,
105}; 108};
106 109
107static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 110static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
108 unsigned long nr_segs, loff_t ppos) 111 unsigned long nr_segs, loff_t ppos)
109{ 112{
110 ssize_t retval; 113 ssize_t retval;
111 struct file *file = iocb->ki_filp; 114 struct file *file = iocb->ki_filp;
@@ -113,25 +116,20 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
113 int err, pos; 116 int err, pos;
114 size_t count = iocb->ki_left; 117 size_t count = iocb->ki_left;
115 118
116 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 119 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
117 {
118 if (file->f_flags & O_APPEND) 120 if (file->f_flags & O_APPEND)
119 pos = inode->i_size; 121 pos = inode->i_size;
120 else 122 else
121 pos = ppos; 123 pos = ppos;
122 124
123 if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + 125 if (inode->i_sb->s_blocksize <
124 pos + count)) 126 (udf_file_entry_alloc_offset(inode) + pos + count)) {
125 {
126 udf_expand_file_adinicb(inode, pos + count, &err); 127 udf_expand_file_adinicb(inode, pos + count, &err);
127 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 128 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
128 {
129 udf_debug("udf_expand_adinicb: err=%d\n", err); 129 udf_debug("udf_expand_adinicb: err=%d\n", err);
130 return err; 130 return err;
131 } 131 }
132 } 132 } else {
133 else
134 {
135 if (pos + count > inode->i_size) 133 if (pos + count > inode->i_size)
136 UDF_I_LENALLOC(inode) = pos + count; 134 UDF_I_LENALLOC(inode) = pos + count;
137 else 135 else
@@ -181,48 +179,47 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
181 * Written, tested, and released. 179 * Written, tested, and released.
182 */ 180 */
183int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 181int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
184 unsigned long arg) 182 unsigned long arg)
185{ 183{
186 int result = -EINVAL; 184 int result = -EINVAL;
187 185
188 if ( file_permission(filp, MAY_READ) != 0 ) 186 if (file_permission(filp, MAY_READ) != 0) {
189 { 187 udf_debug("no permission to access inode %lu\n", inode->i_ino);
190 udf_debug("no permission to access inode %lu\n",
191 inode->i_ino);
192 return -EPERM; 188 return -EPERM;
193 } 189 }
194 190
195 if ( !arg ) 191 if (!arg) {
196 {
197 udf_debug("invalid argument to udf_ioctl\n"); 192 udf_debug("invalid argument to udf_ioctl\n");
198 return -EINVAL; 193 return -EINVAL;
199 } 194 }
200 195
201 switch (cmd) 196 switch (cmd) {
202 { 197 case UDF_GETVOLIDENT:
203 case UDF_GETVOLIDENT: 198 return copy_to_user((char __user *)arg,
204 return copy_to_user((char __user *)arg, 199 UDF_SB_VOLIDENT(inode->i_sb),
205 UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0; 200 32) ? -EFAULT : 0;
206 case UDF_RELOCATE_BLOCKS: 201 case UDF_RELOCATE_BLOCKS:
207 { 202 {
208 long old, new; 203 long old, new;
209 204
210 if (!capable(CAP_SYS_ADMIN)) return -EACCES; 205 if (!capable(CAP_SYS_ADMIN))
211 if (get_user(old, (long __user *)arg)) return -EFAULT; 206 return -EACCES;
207 if (get_user(old, (long __user *)arg))
208 return -EFAULT;
212 if ((result = udf_relocate_blocks(inode->i_sb, 209 if ((result = udf_relocate_blocks(inode->i_sb,
213 old, &new)) == 0) 210 old, &new)) == 0)
214 result = put_user(new, (long __user *)arg); 211 result = put_user(new, (long __user *)arg);
215 212
216 return result; 213 return result;
217 } 214 }
218 case UDF_GETEASIZE: 215 case UDF_GETEASIZE:
219 result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg); 216 result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
220 break; 217 break;
221 218
222 case UDF_GETEABLOCK: 219 case UDF_GETEABLOCK:
223 result = copy_to_user((char __user *)arg, UDF_I_DATA(inode), 220 result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
224 UDF_I_LENEATTR(inode)) ? -EFAULT : 0; 221 UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
225 break; 222 break;
226 } 223 }
227 224
228 return result; 225 return result;
@@ -240,10 +237,9 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
240 * HISTORY 237 * HISTORY
241 * 238 *
242 */ 239 */
243static int udf_release_file(struct inode * inode, struct file * filp) 240static int udf_release_file(struct inode *inode, struct file *filp)
244{ 241{
245 if (filp->f_mode & FMODE_WRITE) 242 if (filp->f_mode & FMODE_WRITE) {
246 {
247 lock_kernel(); 243 lock_kernel();
248 udf_discard_prealloc(inode); 244 udf_discard_prealloc(inode);
249 unlock_kernel(); 245 unlock_kernel();
@@ -252,18 +248,18 @@ static int udf_release_file(struct inode * inode, struct file * filp)
252} 248}
253 249
254const struct file_operations udf_file_operations = { 250const struct file_operations udf_file_operations = {
255 .read = do_sync_read, 251 .read = do_sync_read,
256 .aio_read = generic_file_aio_read, 252 .aio_read = generic_file_aio_read,
257 .ioctl = udf_ioctl, 253 .ioctl = udf_ioctl,
258 .open = generic_file_open, 254 .open = generic_file_open,
259 .mmap = generic_file_mmap, 255 .mmap = generic_file_mmap,
260 .write = do_sync_write, 256 .write = do_sync_write,
261 .aio_write = udf_file_aio_write, 257 .aio_write = udf_file_aio_write,
262 .release = udf_release_file, 258 .release = udf_release_file,
263 .fsync = udf_fsync_file, 259 .fsync = udf_fsync_file,
264 .splice_read = generic_file_splice_read, 260 .splice_read = generic_file_splice_read,
265}; 261};
266 262
267const struct inode_operations udf_file_inode_operations = { 263const struct inode_operations udf_file_inode_operations = {
268 .truncate = udf_truncate, 264 .truncate = udf_truncate,
269}; 265};