From: Al Chu <chu11-i2BcT+NCU+M@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [infiniband-diags] [2/3] support libibnetdisc caching no-overwrite flag
Date: Mon, 19 Apr 2010 11:43:15 -0700 [thread overview]
Message-ID: <1271702595.17987.214.camel@auk31.llnl.gov> (raw)
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
Hey Sasha,
This patch adds a flag to support a no-overwrite caching flag for
libibnetdisc.
Al
--
Albert Chu
chu11-i2BcT+NCU+M@public.gmane.org
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
[-- Attachment #2: 0002-support-libibnetdisc-caching-no-overwrite-flag.patch --]
[-- Type: message/rfc822, Size: 2094 bytes --]
From: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
Subject: [PATCH] support libibnetdisc caching no-overwrite flag
Date: Mon, 19 Apr 2010 11:09:37 -0700
Message-ID: <1271702059.17987.207.camel-X2zTWyBD0EhliZ7u+bvwcg@public.gmane.org>
Signed-off-by: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
---
.../libibnetdisc/include/infiniband/ibnetdisc.h | 3 +++
.../libibnetdisc/src/ibnetdisc_cache.c | 16 ++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
index 136282c..865c1e0 100644
--- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
+++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
@@ -181,6 +181,9 @@ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric);
MAD_EXPORT ibnd_fabric_t *ibnd_load_fabric(const char *file,
unsigned int flags);
+#define IBND_CACHE_FABRIC_FLAG_DEFAULT 0x0000
+#define IBND_CACHE_FABRIC_FLAG_NO_OVERWRITE 0x0001
+
MAD_EXPORT int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file,
unsigned int flags);
diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
index e05ce99..56b59fb 100644
--- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
+++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
@@ -888,10 +888,18 @@ int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file,
return -1;
}
- if (!stat(file, &statbuf)) {
- if (unlink(file) < 0) {
- IBND_DEBUG("error removing '%s': %s\n",
- file, strerror(errno));
+ if (!(flags & IBND_CACHE_FABRIC_FLAG_NO_OVERWRITE)) {
+ if (!stat(file, &statbuf)) {
+ if (unlink(file) < 0) {
+ IBND_DEBUG("error removing '%s': %s\n",
+ file, strerror(errno));
+ return -1;
+ }
+ }
+ }
+ else {
+ if (!stat(file, &statbuf)) {
+ IBND_DEBUG("file '%s' already exists\n", file);
return -1;
}
}
--
1.5.4.5
reply other threads:[~2010-04-19 18:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1271702595.17987.214.camel@auk31.llnl.gov \
--to=chu11-i2bct+ncu+m@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
/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