From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-mtd@lists.infradead.org
Cc: kernel@pengutronix.de, Sascha Hauer <s.hauer@pengutronix.de>,
Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 1/5] mkfs.ubifs: change add_directory argument to 'existing'
Date: Fri, 16 Oct 2015 17:15:15 +0200 [thread overview]
Message-ID: <1445008519-19928-2-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1445008519-19928-1-git-send-email-mkl@pengutronix.de>
From: Sascha Hauer <s.hauer@pengutronix.de>
A 'non_existing' argument which is only used with !non_existing
is just too confusing. Change this to positive logic.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
mkfs.ubifs/mkfs.ubifs.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index ca17e2bca3ac..1b816ae483e0 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -1395,12 +1395,12 @@ static int add_non_dir(const char *path_name, ino_t *inum, unsigned int nlink,
* @dir_name: directory path name
* @dir_inum: UBIFS inode number of directory
* @st: directory inode statistics
- * @non_existing: non-zero if this function is called for a directory which
- * does not exist on the host file-system and it is being
- * created because it is defined in the device table file.
+ * @existing: zero if this function is called for a directory which
+ * does not exist on the host file-system and it is being
+ * created because it is defined in the device table file.
*/
static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
- int non_existing)
+ int existing)
{
struct dirent *entry;
DIR *dir = NULL;
@@ -1416,7 +1416,7 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
unsigned long long dir_creat_sqnum = ++c->max_sqnum;
dbg_msg(2, "%s", dir_name);
- if (!non_existing) {
+ if (existing) {
dir = opendir(dir_name);
if (dir == NULL)
return sys_err_msg("cannot open directory '%s'",
@@ -1434,7 +1434,7 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
* Before adding the directory itself, we have to iterate over all the
* entries the device table adds to this directory and create them.
*/
- for (; !non_existing;) {
+ for (; existing;) {
struct stat dent_st;
errno = 0;
@@ -1492,7 +1492,7 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
inum = ++c->highest_inum;
if (S_ISDIR(dent_st.st_mode)) {
- err = add_directory(name, inum, &dent_st, 0);
+ err = add_directory(name, inum, &dent_st, 1);
if (err)
goto out_free;
nlink += 1;
@@ -1544,7 +1544,7 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
inum = ++c->highest_inum;
if (S_ISDIR(nh_elt->mode)) {
- err = add_directory(name, inum, &fake_st, 1);
+ err = add_directory(name, inum, &fake_st, 0);
if (err)
goto out_free;
nlink += 1;
@@ -1570,14 +1570,14 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
goto out_free;
free(name);
- if (!non_existing && closedir(dir) == -1)
+ if (existing && closedir(dir) == -1)
return sys_err_msg("error closing directory '%s'", dir_name);
return 0;
out_free:
free(name);
- if (!non_existing)
+ if (existing)
closedir(dir);
return -1;
}
@@ -1624,7 +1624,7 @@ static int write_data(void)
}
head_flags = 0;
- err = add_directory(root, UBIFS_ROOT_INO, &root_st, !root);
+ err = add_directory(root, UBIFS_ROOT_INO, &root_st, !!root);
if (err)
return err;
err = add_multi_linked_files();
--
2.6.1
next prev parent reply other threads:[~2015-10-16 15:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 15:15 [PATCH 0/5] mkfs.ubifs: cleanups + extended attribute support Marc Kleine-Budde
2015-10-16 15:15 ` Marc Kleine-Budde [this message]
2015-10-16 15:15 ` [PATCH 2/5] mkfs.ubifs: use xmalloc/xzalloc for allocating memory Marc Kleine-Budde
2015-10-16 15:15 ` [PATCH 3/5] mkfs.ubifs: simplify make_path with xasprintf Marc Kleine-Budde
2015-10-16 15:15 ` [PATCH 4/5] mkfs.ubifs: Add extended attribute support Marc Kleine-Budde
2015-10-16 15:15 ` [PATCH 5/5] mkfs.ubifs: Optionally create extended attribute with inode number Marc Kleine-Budde
2015-11-11 14:56 ` [PATCH 0/5] mkfs.ubifs: cleanups + extended attribute support Daniel Walter
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=1445008519-19928-2-git-send-email-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).