From: Mark Fasheh <mfasheh@suse.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Fasheh <mfasheh@suse.com>,
ocfs2-devel@oss.oracle.com, Joel Becker <joel.becker@oracle.com>,
Louis Rilling <Louis.Rilling@kerlabs.com>
Subject: [PATCH 12/17] configfs: Make configfs_new_dirent() return error code instead of NULL
Date: Mon, 14 Jul 2008 15:01:45 -0700 [thread overview]
Message-ID: <1216072910-27226-13-git-send-email-mfasheh@suse.com> (raw)
In-Reply-To: <1216072910-27226-1-git-send-email-mfasheh@suse.com>
From: Louis Rilling <Louis.Rilling@kerlabs.com>
This patch makes configfs_new_dirent return negative error code instead of NULL,
which will be useful in the next patch to differentiate ENOMEM from ENOENT.
Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
---
fs/configfs/dir.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index a08e5c2..918a332 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -30,6 +30,7 @@
#include <linux/mount.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/err.h>
#include <linux/configfs.h>
#include "configfs_internal.h"
@@ -83,7 +84,7 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
if (!sd)
- return NULL;
+ return ERR_PTR(-ENOMEM);
atomic_set(&sd->s_count, 1);
INIT_LIST_HEAD(&sd->s_links);
@@ -129,8 +130,8 @@ int configfs_make_dirent(struct configfs_dirent * parent_sd,
struct configfs_dirent * sd;
sd = configfs_new_dirent(parent_sd, element);
- if (!sd)
- return -ENOMEM;
+ if (IS_ERR(sd))
+ return PTR_ERR(sd);
sd->s_mode = mode;
sd->s_type = type;
@@ -1277,7 +1278,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
file->private_data = configfs_new_dirent(parent_sd, NULL);
mutex_unlock(&dentry->d_inode->i_mutex);
- return file->private_data ? 0 : -ENOMEM;
+ return IS_ERR(file->private_data) ? PTR_ERR(file->private_data) : 0;
}
--
1.5.4.1
next prev parent reply other threads:[~2008-07-14 22:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 22:01 [git patches] Ocfs2 and Configfs updates for 2.6.27 Mark Fasheh
2008-07-14 22:01 ` [PATCH 01/17] ocfs2: Add CONFIG_OCFS2_FS_STATS config option Mark Fasheh
2008-07-14 22:01 ` [PATCH 02/17] ocfs2: Instrument fs cluster locks Mark Fasheh
2008-07-14 22:01 ` [PATCH 03/17] ocfs2: fix printk format warnings with OCFS2_FS_STATS=n Mark Fasheh
2008-07-14 22:01 ` [PATCH 04/17] ocfs2: use simple_read_from_buffer() Mark Fasheh
2008-07-14 22:01 ` [PATCH 05/17] ocfs2: Silence an error message in ocfs2_file_aio_read() Mark Fasheh
2008-07-14 22:01 ` [PATCH 06/17] ocfs2: Handle error during journal load Mark Fasheh
2008-07-14 22:01 ` [PATCH 07/17] ocfs2/net: Silence build warnings on sparc64 Mark Fasheh
2008-07-14 22:01 ` [PATCH 08/17] ocfs2: Fix CONFIG_OCFS2_DEBUG_FS #ifdefs Mark Fasheh
2008-07-14 22:01 ` [PATCH 09/17] ocfs2: Don't snprintf() without a format Mark Fasheh
2008-07-14 22:01 ` [PATCH 10/17] configfs: Introduce configfs_dirent_lock Mark Fasheh
2008-07-14 22:01 ` [PATCH 11/17] configfs: Protect configfs_dirent s_links list mutations Mark Fasheh
2008-07-14 22:01 ` Mark Fasheh [this message]
2008-07-14 22:01 ` [PATCH 13/17] configfs: Fix deadlock with racing rmdir() and rename() Mark Fasheh
2008-07-14 22:01 ` [PATCH 14/17] configfs: Fix failing mkdir() making racing rmdir() fail Mark Fasheh
2008-07-14 22:01 ` [PATCH 15/17] configfs: Allow ->make_item() and ->make_group() to return detailed errors Mark Fasheh
2008-07-14 22:01 ` [PATCH 16/17] configfs: call drop_link() to cleanup after create_link() failure Mark Fasheh
2008-07-14 22:01 ` [PATCH 17/17] [PATCH] ocfs2: fix oops in mmap_truncate testing Mark Fasheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216072910-27226-13-git-send-email-mfasheh@suse.com \
--to=mfasheh@suse.com \
--cc=Louis.Rilling@kerlabs.com \
--cc=joel.becker@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®