mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
cmd_migrate: fix xattrs
This commit is contained in:
parent
076b4196fc
commit
c3844b0b7f
7
INSTALL
7
INSTALL
@ -1,13 +1,18 @@
|
||||
|
||||
Dependencies:
|
||||
|
||||
* libattr1
|
||||
* libblkid
|
||||
* libuuid
|
||||
* libscrypt
|
||||
* libsodium
|
||||
* libkeyutils
|
||||
* liburcu
|
||||
* pkg-config
|
||||
* zlib1g
|
||||
|
||||
On debian, you can install these with
|
||||
apt install -y libblkid-dev uuid-dev libscrypt-dev libsodium-dev libkeyutils-dev
|
||||
apt install -y pkg-config libblkid-dev uuid-dev libscrypt-dev libsodium-dev
|
||||
libkeyutils-dev liburcu-dev zlib1g-dev libattr1-dev
|
||||
|
||||
Then, just make && make install
|
||||
|
@ -219,25 +219,18 @@ static void copy_xattrs(struct cache_set *c, struct bch_inode_unpacked *dst,
|
||||
char *src)
|
||||
{
|
||||
struct bch_hash_info hash_info = bch_hash_info_init(dst);
|
||||
ssize_t size = llistxattr(src, NULL, 0);
|
||||
if (size < 0)
|
||||
|
||||
char attrs[XATTR_LIST_MAX];
|
||||
ssize_t attrs_size = llistxattr(src, attrs, sizeof(attrs));
|
||||
if (attrs_size < 0)
|
||||
die("listxattr error: %s", strerror(errno));
|
||||
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
char *buf = malloc(size);
|
||||
size = llistxattr(src, buf, size);
|
||||
if (size < 0)
|
||||
die("listxattr error: %s", strerror(errno));
|
||||
|
||||
for (const char *next, *attr = buf;
|
||||
attr <= buf + size;
|
||||
for (const char *next, *attr = attrs;
|
||||
attr < attrs + attrs_size;
|
||||
attr = next) {
|
||||
next = attr + strlen(attr) + 1;
|
||||
|
||||
/* max possible xattr val: */
|
||||
static char val[64 << 10];
|
||||
char val[XATTR_SIZE_MAX];
|
||||
ssize_t val_size = lgetxattr(src, attr, val, sizeof(val));
|
||||
|
||||
if (val_size < 0)
|
||||
@ -250,8 +243,6 @@ static void copy_xattrs(struct cache_set *c, struct bch_inode_unpacked *dst,
|
||||
if (ret < 0)
|
||||
die("error creating xattr: %s", strerror(-ret));
|
||||
}
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
static void write_data(struct cache_set *c,
|
||||
|
3
debian/control
vendored
3
debian/control
vendored
@ -5,7 +5,8 @@ Section: utils
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.5
|
||||
Build-Depends: debhelper (>= 9), pkg-config, libblkid-dev, uuid-dev,
|
||||
libscrypt-dev, libsodium-dev, libkeyutils-dev, liburcu-dev, zlib1g-dev
|
||||
libscrypt-dev, libsodium-dev, libkeyutils-dev, liburcu-dev, zlib1g-dev,
|
||||
libattr1-dev
|
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/bcache-tools.git
|
||||
Vcs-Git: git://anonscm.debian.org/collab-maint/bcache-tools.git
|
||||
Homepage: http://bcache.evilpiepirate.org/
|
||||
|
Loading…
Reference in New Issue
Block a user