Displaying 11 results from an estimated 11 matches for "_listxattrs".
2014 Jan 10
0
[PATCH] daemon: xattr: move the listxattrs code in an own function
...(const char *xattr, const char *val, int vallen, const char *path, int (*setxattr) (const char *path, const char *name, const void *value, size_t size, int flags));
static int _removexattr (const char *xattr, const char *path, int (*removexattr) (const char *path, const char *name));
+static char *_listxattrs (const char *path, ssize_t (*listxattr) (const char *path, char *list, size_t size), ssize_t *size);
guestfs_int_xattr_list *
do_getxattrs (const char *path)
@@ -111,27 +112,10 @@ getxattrs (const char *path,
size_t i, j;
guestfs_int_xattr_list *r = NULL;
- CHROOT_IN;
- len = listxatt...
2020 Mar 12
8
[PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
https://bugzilla.redhat.com/show_bug.cgi?id=1811539
Commands including virt-diff which read extended attributes will
sometimes fail on NTFS filesystems that are using system compressed.
The reason is complex, see comment 5 of the bug linked above.
This patch filters out the troublesome xattr. For justification, see
the comment I added in patch 3.
Patch 1 & 2 are refactoring.
I was on the
2014 Jan 10
4
Re: RFC: copy-attributes command
On Tuesday 07 January 2014 21:04:36 Richard W.M. Jones wrote:
> On Tue, Jan 07, 2014 at 04:06:43PM +0100, Pino Toscano wrote:
> > Hi,
> >
> > attached there is a prototype of patch for adding a new
> > copy-attributes command. Such command would allow copy the
> > attributes of a "file" to>
> > another, so for example in guestfish:
> >
2020 Mar 12
0
[PATCH libguestfs 1/3] daemon: xattr: Refactor code which splits attr names from the kernel.
...tatic int
compare_xattrs (const void *vxa1, const void *vxa2)
{
@@ -106,7 +135,8 @@ getxattrs (const char *path,
{
ssize_t len, vlen;
CLEANUP_FREE char *buf = NULL;
- size_t i, j;
+ CLEANUP_FREE_STRING_LIST char **names = NULL;
+ size_t i;
guestfs_int_xattr_list *r = NULL;
buf = _listxattrs (path, listxattr, &len);
@@ -114,18 +144,17 @@ getxattrs (const char *path,
/* _listxattrs issues reply_with_perror already. */
goto error;
+ names = split_attr_names (buf, len);
+ if (names == NULL)
+ goto error;
+
r = calloc (1, sizeof (*r));
if (r == NULL) {
reply...
2020 Mar 16
0
[PATCH libguestfs v2 1/3] daemon: xattr: Refactor code which splits attr names from the kernel.
...compare_xattrs (const void *vxa1, const void *vxa2)
{
@@ -106,7 +132,8 @@ getxattrs (const char *path,
{
ssize_t len, vlen;
CLEANUP_FREE char *buf = NULL;
- size_t i, j;
+ CLEANUP_FREE /* not string list */ char **names = NULL;
+ size_t i;
guestfs_int_xattr_list *r = NULL;
buf = _listxattrs (path, listxattr, &len);
@@ -114,18 +141,17 @@ getxattrs (const char *path,
/* _listxattrs issues reply_with_perror already. */
goto error;
+ names = split_attr_names (buf, len);
+ if (names == NULL)
+ goto error;
+
r = calloc (1, sizeof (*r));
if (r == NULL) {
reply...
2020 Mar 16
6
[PATCH libguestfs v2 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
v1 here:
https://www.redhat.com/archives/libguestfs/2020-March/msg00099.html
This one fixes most of the points picked up in review, and does not
strdup the strings which should keep down memory usage if that is a
concern.
Rich.
2020 Mar 13
0
Re: [PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
...3.
The idea is fine, however I'm slightly concerned about the increased
memory usage due to the split + filtering done.
Now that I took a look at the code again (wow, last time I touched it
was more than 5 years ago), an alternative approach could be:
- refactor do_internal_lxattrlist to use _listxattrs
- edit/replace in-place the buffer to-be-returned by _listxattrs
filtering out the names we do not want
This way the rest of the existing code needs almost no changes.
--
Pino Toscano
2020 Mar 16
0
[PATCH libguestfs v2 3/3] daemon: xattr: Filter out user.WofCompressedData from xattrs (RHBZ#1811539).
...th,
{
ssize_t len, vlen;
CLEANUP_FREE char *buf = NULL;
+ CLEANUP_FREE /* not string list */ char **names_unfiltered = NULL;
CLEANUP_FREE /* not string list */ char **names = NULL;
size_t i;
guestfs_int_xattr_list *r = NULL;
@@ -141,7 +167,10 @@ getxattrs (const char *path,
/* _listxattrs issues reply_with_perror already. */
goto error;
- names = split_attr_names (buf, len);
+ names_unfiltered = split_attr_names (buf, len);
+ if (names_unfiltered == NULL)
+ goto error;
+ names = filter_list (not_hidden_xattr, names_unfiltered);
if (names == NULL)
goto error;...
2014 Apr 30
2
[PATCH] daemon: xattr: factorize do_getxattr and do_lgetxattr
...(const char *xattr, const char *val, int vallen, const char *path, int (*setxattr) (const char *path, const char *name, const void *value, size_t size, int flags));
static int _removexattr (const char *xattr, const char *path, int (*removexattr) (const char *path, const char *name));
static char *_listxattrs (const char *path, ssize_t (*listxattr) (const char *path, char *list, size_t size), ssize_t *size);
+static char *_getxattr (const char *name, const char *path, ssize_t (*getxattr) (const char *path, const char *name, void *value, size_t size), size_t *size_r);
guestfs_int_xattr_list *
do_getx...
2014 Jan 13
0
[PATCH] New API: copy-attributes.
...-541,8 +541,77 @@ do_lgetxattr (const char *path, const char *name, size_t *size_r)
return buf; /* caller frees */
}
+int
+copy_xattrs (const char *src, const char *dest)
+{
+ ssize_t len, vlen, ret, attrval_len = 0;
+ CLEANUP_FREE char *buf = NULL, *attrval = NULL;
+ size_t i;
+
+ buf = _listxattrs (src, listxattr, &len);
+ if (buf == NULL)
+ /* _listxattrs issues reply_with_perror already. */
+ goto error;
+
+ /* What we get from the kernel is a string "foo\0bar\0baz" of length
+ * len.
+ */
+ for (i = 0; i < (size_t) len; i += strlen (&buf[i]) + 1) {
+ C...
2014 Jan 07
8
RFC: copy-attributes command
Hi,
attached there is a prototype of patch for adding a new copy-attributes
command. Such command would allow copy the attributes of a "file" to
another, so for example in guestfish:
copy-attributes foo bar permissions:true xattributes:false
would only copy the permissions of foo to bar, not copying its extended
attributes too.
Just few notes:
- my first daemon command, so