diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-22 04:39:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:33:35 -0400 |
commit | d95852777bc8ba6b3ad3397d495c5f9dd8ca8383 (patch) | |
tree | 96e9d8b1d33c4f6f7b5ba5be0fa4fd8f77c7a67f /fs/cifs | |
parent | 3d8a00d2099ebc6d5a6e95fadaf861709d9919a8 (diff) |
make ->atomic_open() return int
Change of calling conventions:
old new
NULL 1
file 0
ERR_PTR(-ve) -ve
Caller *knows* that struct file *; no need to return it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsfs.h | 6 | ||||
-rw-r--r-- | fs/cifs/dir.c | 17 |
2 files changed, 11 insertions, 12 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 92a7c3d8a031..58d9aca46a40 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -46,9 +46,9 @@ extern const struct inode_operations cifs_dir_inode_ops; | |||
46 | extern struct inode *cifs_root_iget(struct super_block *); | 46 | extern struct inode *cifs_root_iget(struct super_block *); |
47 | extern int cifs_create(struct inode *, struct dentry *, umode_t, | 47 | extern int cifs_create(struct inode *, struct dentry *, umode_t, |
48 | struct nameidata *); | 48 | struct nameidata *); |
49 | extern struct file *cifs_atomic_open(struct inode *, struct dentry *, | 49 | extern int cifs_atomic_open(struct inode *, struct dentry *, |
50 | struct opendata *, unsigned, umode_t, | 50 | struct opendata *, unsigned, umode_t, |
51 | int *); | 51 | int *); |
52 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, | 52 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, |
53 | struct nameidata *); | 53 | struct nameidata *); |
54 | extern int cifs_unlink(struct inode *dir, struct dentry *dentry); | 54 | extern int cifs_unlink(struct inode *dir, struct dentry *dentry); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 6cdf23fd70ee..8ca70b102b95 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -376,7 +376,7 @@ out: | |||
376 | return rc; | 376 | return rc; |
377 | } | 377 | } |
378 | 378 | ||
379 | struct file * | 379 | int |
380 | cifs_atomic_open(struct inode *inode, struct dentry *direntry, | 380 | cifs_atomic_open(struct inode *inode, struct dentry *direntry, |
381 | struct opendata *od, unsigned oflags, umode_t mode, | 381 | struct opendata *od, unsigned oflags, umode_t mode, |
382 | int *opened) | 382 | int *opened) |
@@ -403,15 +403,15 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
403 | if (!(oflags & O_CREAT)) { | 403 | if (!(oflags & O_CREAT)) { |
404 | struct dentry *res = cifs_lookup(inode, direntry, NULL); | 404 | struct dentry *res = cifs_lookup(inode, direntry, NULL); |
405 | if (IS_ERR(res)) | 405 | if (IS_ERR(res)) |
406 | return ERR_CAST(res); | 406 | return PTR_ERR(res); |
407 | 407 | ||
408 | finish_no_open(od, res); | 408 | finish_no_open(od, res); |
409 | return NULL; | 409 | return 1; |
410 | } | 410 | } |
411 | 411 | ||
412 | rc = check_name(direntry); | 412 | rc = check_name(direntry); |
413 | if (rc) | 413 | if (rc) |
414 | return ERR_PTR(rc); | 414 | return rc; |
415 | 415 | ||
416 | xid = GetXid(); | 416 | xid = GetXid(); |
417 | 417 | ||
@@ -428,13 +428,12 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
428 | rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, | 428 | rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, |
429 | &oplock, &fileHandle, opened); | 429 | &oplock, &fileHandle, opened); |
430 | 430 | ||
431 | if (rc) { | 431 | if (rc) |
432 | filp = ERR_PTR(rc); | ||
433 | goto out; | 432 | goto out; |
434 | } | ||
435 | 433 | ||
436 | filp = finish_open(od, direntry, generic_file_open, opened); | 434 | filp = finish_open(od, direntry, generic_file_open, opened); |
437 | if (IS_ERR(filp)) { | 435 | if (IS_ERR(filp)) { |
436 | rc = PTR_ERR(filp); | ||
438 | CIFSSMBClose(xid, tcon, fileHandle); | 437 | CIFSSMBClose(xid, tcon, fileHandle); |
439 | goto out; | 438 | goto out; |
440 | } | 439 | } |
@@ -443,14 +442,14 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
443 | if (pfile_info == NULL) { | 442 | if (pfile_info == NULL) { |
444 | CIFSSMBClose(xid, tcon, fileHandle); | 443 | CIFSSMBClose(xid, tcon, fileHandle); |
445 | fput(filp); | 444 | fput(filp); |
446 | filp = ERR_PTR(-ENOMEM); | 445 | rc = -ENOMEM; |
447 | } | 446 | } |
448 | 447 | ||
449 | out: | 448 | out: |
450 | cifs_put_tlink(tlink); | 449 | cifs_put_tlink(tlink); |
451 | free_xid: | 450 | free_xid: |
452 | FreeXid(xid); | 451 | FreeXid(xid); |
453 | return filp; | 452 | return rc; |
454 | } | 453 | } |
455 | 454 | ||
456 | int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, | 455 | int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, |