Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-15141 quota: optimize capability check for root squash
[fs/lustre-release.git]
/
lustre
/
utils
/
ll_decode_linkea.c
diff --git
a/lustre/utils/ll_decode_linkea.c
b/lustre/utils/ll_decode_linkea.c
index
0e3f863
..
9327428
100644
(file)
--- a/
lustre/utils/ll_decode_linkea.c
+++ b/
lustre/utils/ll_decode_linkea.c
@@
-36,12
+36,26
@@
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
+#include <ctype.h>
#include <sys/types.h>
#include <sys/xattr.h>
#include <sys/types.h>
#include <sys/xattr.h>
-#include <linux/lustre_fid.h>
+#include <linux/lustre
/lustre
_fid.h>
#define BUFFER_SIZE 65536
#define BUFFER_SIZE 65536
+static void print_name(const char *cp, int len)
+{
+ unsigned char ch;
+
+ while (len--) {
+ ch = *cp++;
+ if (!isprint(ch) || ch == '\\')
+ printf("\\x%02x", ch);
+ else
+ putchar(ch);
+ }
+}
+
int decode_linkea(const char *fname)
{
char buf[BUFFER_SIZE];
int decode_linkea(const char *fname)
{
char buf[BUFFER_SIZE];
@@
-86,7
+100,7
@@
int decode_linkea(const char *fname)
if (leh->leh_len > size) {
fprintf(stderr,
"%s: invalid length %llu, should smaller than %zd\n",
if (leh->leh_len > size) {
fprintf(stderr,
"%s: invalid length %llu, should smaller than %zd\n",
- fname, leh->leh_len, size);
+ fname,
(unsigned long long)
leh->leh_len, size);
return -1;
}
return -1;
}
@@
-98,22
+112,26
@@
int decode_linkea(const char *fname)
length += reclen;
if (length > leh->leh_len) {
fprintf(stderr,
length += reclen;
if (length > leh->leh_len) {
fprintf(stderr,
- "%s: length exceeded, expected %lld, got %lld\n",
- fname, leh->leh_len, length);
+ "%s: length exceeded, expected %llu, got %llu\n",
+ fname, (unsigned long long)leh->leh_len,
+ (unsigned long long)length);
return -1;
}
memcpy(&pfid, &lee->lee_parent_fid, sizeof(pfid));
fid_be_to_cpu(&pfid, &pfid);
return -1;
}
memcpy(&pfid, &lee->lee_parent_fid, sizeof(pfid));
fid_be_to_cpu(&pfid, &pfid);
- printf(" %d: pfid "DFID", name '%s'\n", i, PFID(&pfid),
- lee->lee_name);
+ printf(" %d: pfid "DFID", name '", i, PFID(&pfid));
+ print_name(lee->lee_name, reclen - (int)sizeof(*lee));
+ printf("'\n");
lee = (struct link_ea_entry *)((char *)lee + reclen);
}
if (length != leh->leh_len) {
fprintf(stderr,
lee = (struct link_ea_entry *)((char *)lee + reclen);
}
if (length != leh->leh_len) {
fprintf(stderr,
- "%s: length mismatch, expected %lld, got %lld\n",
- fname, leh->leh_len, length);
+ "%s: length mismatch, expected %llu, got %llu\n",
+ fname,
+ (unsigned long long)leh->leh_len,
+ (unsigned long long)length);
return -1;
}
return -1;
}