summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/compat.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-16 09:38:49 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-17 23:11:04 -0700
commit0a1f00cdcb087e00c184c62c1a9f22803c257cf2 (patch)
tree85b3ae636ec6084ec46a883ca7e090575eb60fba /libglusterfs/src/compat.c
parent0f39192ef6bc7b1c74cfaeb04ed21305996d67e9 (diff)
libglusterfs/src/*.c: log enhancement
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'libglusterfs/src/compat.c')
-rw-r--r--libglusterfs/src/compat.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index a24f3aabd..42c20f527 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -40,10 +40,7 @@
#ifdef GF_SOLARIS_HOST_OS
int
-solaris_fsetxattr(int fd,
- const char* key,
- const char *value,
- size_t size,
+solaris_fsetxattr(int fd, const char* key, const char *value, size_t size,
int flags)
{
int attrfd = -1;
@@ -67,10 +64,7 @@ solaris_fsetxattr(int fd,
int
-solaris_fgetxattr(int fd,
- const char* key,
- char *value,
- size_t size)
+solaris_fgetxattr(int fd, const char* key, char *value, size_t size)
{
int attrfd = -1;
int ret = 0;
@@ -86,12 +80,12 @@ solaris_fgetxattr(int fd,
}
close (attrfd);
} else {
- if (errno == ENOENT)
- errno = ENODATA;
if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_DEBUG,
+ gf_log ("libglusterfs", GF_LOG_INFO,
"Couldn't read extended attribute for the file %d (%d)",
fd, errno);
+ if (errno == ENOENT)
+ errno = ENODATA;
return -1;
}
@@ -219,11 +213,8 @@ out:
}
int
-solaris_setxattr(const char *path,
- const char* key,
- const char *value,
- size_t size,
- int flags)
+solaris_setxattr(const char *path, const char* key, const char *value,
+ size_t size, int flags)
{
int attrfd = -1;
int ret = 0;
@@ -255,9 +246,7 @@ solaris_setxattr(const char *path,
int
-solaris_listxattr(const char *path,
- char *list,
- size_t size)
+solaris_listxattr(const char *path, char *list, size_t size)
{
int attrdirfd = -1;
ssize_t len = 0;
@@ -279,15 +268,18 @@ solaris_listxattr(const char *path,
if (dirptr) {
while ((dent = readdir(dirptr))) {
size_t listlen = strlen(dent->d_name);
- if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ if (!strcmp(dent->d_name, ".") ||
+ !strcmp(dent->d_name, "..")) {
/* we don't want "." and ".." here */
continue;
}
if (size == 0) {
- /* return the current size of the list of extended attribute names*/
+ /* return the current size of the list
+ of extended attribute names*/
len += listlen + 1;
} else {
- /* check size and copy entrie + nul into list. */
+ /* check size and copy entry + null
+ into list. */
if ((len + listlen + 1) > size) {
errno = ERANGE;
len = -1;
@@ -321,9 +313,7 @@ out:
int
-solaris_flistxattr(int fd,
- char *list,
- size_t size)
+solaris_flistxattr(int fd, char *list, size_t size)
{
int attrdirfd = -1;
ssize_t len = 0;
@@ -338,15 +328,18 @@ solaris_flistxattr(int fd,
if (dirptr) {
while ((dent = readdir(dirptr))) {
size_t listlen = strlen(dent->d_name);
- if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ if (!strcmp(dent->d_name, ".") ||
+ !strcmp(dent->d_name, "..")) {
/* we don't want "." and ".." here */
continue;
}
if (size == 0) {
- /* return the current size of the list of extended attribute names*/
+ /* return the current size of the list
+ of extended attribute names*/
len += listlen + 1;
} else {
- /* check size and copy entrie + nul into list. */
+ /* check size and copy entry + null
+ into list. */
if ((len + listlen + 1) > size) {
errno = ERANGE;
len = -1;
@@ -375,8 +368,7 @@ solaris_flistxattr(int fd,
int
-solaris_removexattr(const char *path,
- const char* key)
+solaris_removexattr(const char *path, const char* key)
{
int ret = -1;
int attrfd = -1;
@@ -430,12 +422,12 @@ solaris_getxattr(const char *path,
}
close (attrfd);
} else {
+ if (errno != ENOENT)
+ gf_log ("libglusterfs", GF_LOG_INFO,
+ "Couldn't read extended attribute for the file %s (%s)",
+ path, strerror (errno));
if (errno == ENOENT)
errno = ENODATA;
- if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_DEBUG,
- "Couldn't read extended attribute for the file %s (%d)",
- path, errno);
ret = -1;
}
if (mapped_path)