1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
|
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#include "libxfs.h"
#include "command.h"
#include "attrset.h"
#include "io.h"
#include "output.h"
#include "type.h"
#include "init.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "inode.h"
#include "malloc.h"
#include <sys/xattr.h>
#include "libfrog/fsproperties.h"
#include "libxfs/listxattr.h"
static int attr_list_f(int argc, char **argv);
static int attr_get_f(int argc, char **argv);
static int attr_set_f(int argc, char **argv);
static int attr_remove_f(int argc, char **argv);
static void attrlist_help(void);
static void attrget_help(void);
static void attrset_help(void);
static const cmdinfo_t attr_list_cmd =
{ "attr_list", "alist", attr_list_f, 0, -1, 0,
N_("[-r|-s|-u|-p|-Z] [-v]"),
N_("list attributes on the current inode"), attrlist_help };
static const cmdinfo_t attr_get_cmd =
{ "attr_get", "aget", attr_get_f, 1, -1, 0,
N_("[-r|-s|-u|-p|-Z] name"),
N_("get the named attribute on the current inode"), attrget_help };
static const cmdinfo_t attr_set_cmd =
{ "attr_set", "aset", attr_set_f, 1, -1, 0,
N_("[-r|-s|-u|-p|-Z] [-n] [-R|-C] [-v n] name"),
N_("set the named attribute on the current inode"), attrset_help };
static const cmdinfo_t attr_remove_cmd =
{ "attr_remove", "aremove", attr_remove_f, 1, -1, 0,
N_("[-r|-s|-u|-p|-Z] [-n] name"),
N_("remove the named attribute from the current inode"), attrset_help };
static void
attrlist_help(void)
{
dbprintf(_(
"\n"
" The attr_list command provide interfaces for listing all extended attributes\n"
" attached to an inode.\n"
" There are 4 namespace flags:\n"
" -r -- 'root'\n"
" -u -- 'user' (default)\n"
" -s -- 'secure'\n"
" -p -- 'parent'\n"
" -Z -- fs property\n"
"\n"
" -v -- print the value of the attributes\n"
"\n"));
}
static void
attrget_help(void)
{
dbprintf(_(
"\n"
" The attr_get command provide interfaces for retrieving the values of extended\n"
" attributes of a file. This command requires attribute names to be specified.\n"
" There are 4 namespace flags:\n"
" -r -- 'root'\n"
" -u -- 'user' (default)\n"
" -s -- 'secure'\n"
" -p -- 'parent'\n"
" -Z -- fs property\n"
"\n"));
}
static void
attrset_help(void)
{
dbprintf(_(
"\n"
" The 'attr_set' and 'attr_remove' commands provide interfaces for debugging\n"
" the extended attribute allocation and removal code.\n"
" Both commands require an attribute name to be specified, and the attr_set\n"
" command allows an optional value length (-v) to be provided as well.\n"
" There are 4 namespace flags:\n"
" -r -- 'root'\n"
" -u -- 'user' (default)\n"
" -s -- 'secure'\n"
" -p -- 'parent'\n"
" -Z -- fs property\n"
"\n"
" For attr_set, these options further define the type of set operation:\n"
" -C -- 'create' - create attribute, fail if it already exists\n"
" -R -- 'replace' - replace attribute, fail if it does not exist\n"
"\n"
" If the attribute value is a string, it can be specified after the\n"
" attribute name.\n"
"\n"
" The backward compatibility mode 'noattr2' can be emulated (-n) also.\n"
"\n"));
}
void
attrset_init(void)
{
if (!expert_mode)
return;
add_command(&attr_list_cmd);
add_command(&attr_get_cmd);
add_command(&attr_set_cmd);
add_command(&attr_remove_cmd);
}
static unsigned char *
get_buf_from_file(
const char *fname,
size_t bufsize,
int *namelen)
{
FILE *fp;
unsigned char *buf;
size_t sz;
buf = malloc(bufsize + 1);
if (!buf) {
perror("malloc");
return NULL;
}
fp = fopen(fname, "r");
if (!fp) {
perror(fname);
goto out_free;
}
sz = fread(buf, sizeof(char), bufsize, fp);
if (sz == 0) {
printf("%s: Could not read anything from file\n", fname);
goto out_fp;
}
fclose(fp);
*namelen = sz;
return buf;
out_fp:
fclose(fp);
out_free:
free(buf);
return NULL;
}
#define LIBXFS_ATTR_NS (LIBXFS_ATTR_SECURE | \
LIBXFS_ATTR_ROOT | \
LIBXFS_ATTR_PARENT)
static bool
adjust_fsprop_attr_name(
struct xfs_da_args *args,
bool *free_name)
{
const char *o = (const char *)args->name;
char *p;
int ret;
if ((args->attr_filter & LIBXFS_ATTR_NS) != LIBXFS_ATTR_ROOT) {
dbprintf(_("fs properties must be ATTR_ROOT\n"));
return false;
}
ret = fsprop_name_to_attr_name(o, &p);
if (ret < 0) {
dbprintf(_("could not allocate fs property name string\n"));
return false;
}
args->namelen = ret;
args->name = (const uint8_t *)p;
if (*free_name)
free((void *)o);
*free_name = true;
if (args->namelen > MAXNAMELEN) {
dbprintf(_("%s: name too long\n"), args->name);
return false;
}
if (args->valuelen > ATTR_MAX_VALUELEN) {
dbprintf(_("%s: value too long\n"), args->name);
return false;
}
return true;
}
static void
print_fsprop(
struct xfs_da_args *args)
{
const char *p =
attr_name_to_fsprop_name((const char *)args->name);
if (p)
printf("%s=%.*s\n", p, args->valuelen, (char *)args->value);
else
fprintf(stderr, _("%s: not a fs property?\n"), args->name);
}
static int
attr_set_f(
int argc,
char **argv)
{
struct xfs_da_args args = {
.geo = mp->m_attr_geo,
.whichfork = XFS_ATTR_FORK,
.op_flags = XFS_DA_OP_OKNOENT,
};
char *sp;
char *name_from_file = NULL;
char *value_from_file = NULL;
bool free_name = false;
enum xfs_attr_update op = XFS_ATTRUPDATE_UPSERT;
bool fsprop = false;
int c;
int error;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "ruspCRnN:v:V:Z")) != EOF) {
switch (c) {
/* namespaces */
case 'Z':
fsprop = true;
fallthrough;
case 'r':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_ROOT;
break;
case 'u':
args.attr_filter &= ~LIBXFS_ATTR_NS;
break;
case 's':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_SECURE;
break;
case 'p':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= XFS_ATTR_PARENT;
break;
/* modifiers */
case 'C':
op = XFS_ATTRUPDATE_CREATE;
break;
case 'R':
op = XFS_ATTRUPDATE_REPLACE;
break;
case 'N':
name_from_file = optarg;
break;
case 'n':
/*
* We never touch attr2 these days; leave this here to
* avoid breaking scripts.
*/
break;
/* value length */
case 'v':
if (value_from_file) {
dbprintf(_("already set value file\n"));
return 0;
}
args.valuelen = strtol(optarg, &sp, 0);
if (*sp != '\0' ||
args.valuelen < 0 || args.valuelen > 64 * 1024) {
dbprintf(_("bad attr_set valuelen %s\n"), optarg);
return 0;
}
break;
case 'V':
if (args.valuelen != 0) {
dbprintf(_("already set valuelen\n"));
return 0;
}
value_from_file = optarg;
break;
default:
dbprintf(_("bad option for attr_set command\n"));
return 0;
}
}
if (name_from_file) {
int namelen;
if (optind != argc) {
dbprintf(_("too many options for attr_set (no name needed)\n"));
return 0;
}
args.name = get_buf_from_file(name_from_file, MAXNAMELEN,
&namelen);
if (!args.name)
return 0;
free_name = true;
args.namelen = namelen;
} else {
if (optind != argc - 1 && optind != argc - 2) {
dbprintf(_("too few options for attr_set (no name given)\n"));
return 0;
}
args.name = (const unsigned char *)argv[optind];
if (!args.name) {
dbprintf(_("invalid name\n"));
return 0;
}
args.namelen = strlen(argv[optind]);
if (args.namelen >= MAXNAMELEN) {
dbprintf(_("name too long\n"));
goto out;
}
}
if (value_from_file) {
int valuelen;
args.value = get_buf_from_file(value_from_file,
XFS_XATTR_SIZE_MAX, &valuelen);
if (!args.value)
goto out;
args.valuelen = valuelen;
} else if (args.valuelen) {
args.value = memalign(getpagesize(), args.valuelen);
if (!args.value) {
dbprintf(_("cannot allocate buffer (%d)\n"),
args.valuelen);
goto out;
}
memset(args.value, 'v', args.valuelen);
} else if (optind == argc - 2) {
args.valuelen = strlen(argv[optind + 1]);
args.value = strdup(argv[optind + 1]);
if (!args.value) {
dbprintf(_("cannot allocate buffer (%d)\n"),
args.valuelen);
goto out;
}
}
if (fsprop) {
if (!fsprop_validate((const char *)args.name, args.value)) {
dbprintf(_("%s: invalid value \"%s\"\n"),
args.name, args.value);
goto out;
}
if (!adjust_fsprop_attr_name(&args, &free_name))
goto out;
}
if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &args.dp)) {
dbprintf(_("failed to iget inode %llu\n"),
(unsigned long long)iocur_top->ino);
goto out;
}
args.owner = iocur_top->ino;
libxfs_attr_sethash(&args);
error = -libxfs_attr_set(&args, op, false);
if (error) {
dbprintf(_("failed to set attr %s on inode %llu: %s\n"),
args.name, (unsigned long long)iocur_top->ino,
strerror(error));
goto out;
}
if (fsprop)
print_fsprop(&args);
/* refresh with updated inode contents */
set_cur_inode(iocur_top->ino);
out:
if (args.dp)
libxfs_irele(args.dp);
if (args.value)
free(args.value);
if (free_name)
free((void *)args.name);
return 0;
}
static int
attr_remove_f(
int argc,
char **argv)
{
struct xfs_da_args args = {
.geo = mp->m_attr_geo,
.whichfork = XFS_ATTR_FORK,
.op_flags = XFS_DA_OP_OKNOENT,
};
char *name_from_file = NULL;
bool free_name = false;
bool fsprop = false;
int c;
int error;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "ruspnN:Z")) != EOF) {
switch (c) {
/* namespaces */
case 'Z':
fsprop = true;
fallthrough;
case 'r':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_ROOT;
break;
case 'u':
args.attr_filter &= ~LIBXFS_ATTR_NS;
break;
case 's':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_SECURE;
break;
case 'p':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= XFS_ATTR_PARENT;
break;
case 'N':
name_from_file = optarg;
break;
case 'n':
/*
* We never touch attr2 these days; leave this here to
* avoid breaking scripts.
*/
break;
default:
dbprintf(_("bad option for attr_remove command\n"));
return 0;
}
}
if (name_from_file) {
int namelen;
if (optind != argc) {
dbprintf(_("too many options for attr_set (no name needed)\n"));
return 0;
}
args.name = get_buf_from_file(name_from_file, MAXNAMELEN,
&namelen);
if (!args.name)
return 0;
free_name = true;
args.namelen = namelen;
} else {
if (optind != argc - 1) {
dbprintf(_("too few options for attr_remove (no name given)\n"));
return 0;
}
args.name = (const unsigned char *)argv[optind];
if (!args.name) {
dbprintf(_("invalid name\n"));
return 0;
}
args.namelen = strlen(argv[optind]);
if (args.namelen >= MAXNAMELEN) {
dbprintf(_("name too long\n"));
return 0;
}
}
if (fsprop && !adjust_fsprop_attr_name(&args, &free_name))
goto out;
if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &args.dp)) {
dbprintf(_("failed to iget inode %llu\n"),
(unsigned long long)iocur_top->ino);
goto out;
}
args.owner = iocur_top->ino;
libxfs_attr_sethash(&args);
error = -libxfs_attr_set(&args, XFS_ATTRUPDATE_REMOVE, false);
if (error) {
dbprintf(_("failed to remove attr %s from inode %llu: %s\n"),
(unsigned char *)args.name,
(unsigned long long)iocur_top->ino,
strerror(error));
goto out;
}
/* refresh with updated inode contents */
set_cur_inode(iocur_top->ino);
out:
if (args.dp)
libxfs_irele(args.dp);
if (free_name)
free((void *)args.name);
return 0;
}
static int
attr_get_f(
int argc,
char **argv)
{
struct xfs_da_args args = {
.geo = mp->m_attr_geo,
.whichfork = XFS_ATTR_FORK,
.op_flags = XFS_DA_OP_OKNOENT,
};
char *name_from_file = NULL;
bool free_name = false;
bool fsprop = false;
int c;
int error;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "ruspN:Z")) != EOF) {
switch (c) {
/* namespaces */
case 'Z':
fsprop = true;
fallthrough;
case 'r':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_ROOT;
break;
case 'u':
args.attr_filter &= ~LIBXFS_ATTR_NS;
break;
case 's':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= LIBXFS_ATTR_SECURE;
break;
case 'p':
args.attr_filter &= ~LIBXFS_ATTR_NS;
args.attr_filter |= XFS_ATTR_PARENT;
break;
case 'N':
name_from_file = optarg;
break;
default:
dbprintf(_("bad option for attr_get command\n"));
return 0;
}
}
if (name_from_file) {
int namelen;
if (optind != argc) {
dbprintf(_("too many options for attr_get (no name needed)\n"));
return 0;
}
args.name = get_buf_from_file(name_from_file, MAXNAMELEN,
&namelen);
if (!args.name)
return 0;
free_name = true;
args.namelen = namelen;
} else {
if (optind != argc - 1) {
dbprintf(_("too few options for attr_get (no name given)\n"));
return 0;
}
args.name = (const unsigned char *)argv[optind];
if (!args.name) {
dbprintf(_("invalid name\n"));
return 0;
}
args.namelen = strlen(argv[optind]);
if (args.namelen >= MAXNAMELEN) {
dbprintf(_("name too long\n"));
goto out;
}
}
if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &args.dp)) {
dbprintf(_("failed to iget inode %llu\n"),
(unsigned long long)iocur_top->ino);
goto out;
}
if (fsprop && !adjust_fsprop_attr_name(&args, &free_name))
goto out;
args.owner = iocur_top->ino;
libxfs_attr_sethash(&args);
/*
* Look up attr value with a maximally long length and a null buffer
* to return the value and the correct length.
*/
args.valuelen = XATTR_SIZE_MAX;
error = -libxfs_attr_get(&args);
if (error) {
dbprintf(_("failed to get attr %s on inode %llu: %s\n"),
args.name, (unsigned long long)iocur_top->ino,
strerror(error));
goto out;
}
if (fsprop)
print_fsprop(&args);
else
printf("%.*s\n", args.valuelen, (char *)args.value);
out:
if (args.dp)
libxfs_irele(args.dp);
if (args.value)
free(args.value);
if (free_name)
free((void *)args.name);
return 0;
}
struct attrlist_ctx {
unsigned int attr_filter;
bool print_values;
bool fsprop;
};
static int
attrlist_print(
struct xfs_trans *tp,
struct xfs_inode *ip,
unsigned int attr_flags,
const unsigned char *name,
unsigned int namelen,
const void *value,
unsigned int valuelen,
void *priv)
{
struct attrlist_ctx *ctx = priv;
struct xfs_da_args args = {
.geo = mp->m_attr_geo,
.whichfork = XFS_ATTR_FORK,
.op_flags = XFS_DA_OP_OKNOENT,
.dp = ip,
.owner = ip->i_ino,
.trans = tp,
.attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK,
.name = name,
.namelen = namelen,
};
char namebuf[MAXNAMELEN + 1];
const char *print_name = namebuf;
int error;
if ((attr_flags & XFS_ATTR_NSP_ONDISK_MASK) != ctx->attr_filter)
return 0;
/* Make sure the name is null terminated. */
memcpy(namebuf, name, namelen);
namebuf[MAXNAMELEN] = 0;
if (ctx->fsprop) {
const char *p = attr_name_to_fsprop_name(namebuf);
if (!p)
return 0;
namelen -= (p - namebuf);
print_name = p;
}
if (!ctx->print_values) {
printf("%.*s\n", namelen, print_name);
return 0;
}
if (value) {
printf("%.*s=%.*s\n", namelen, print_name, valuelen,
(char *)value);
return 0;
}
libxfs_attr_sethash(&args);
/*
* Look up attr value with a maximally long length and a null buffer
* to return the value and the correct length.
*/
args.valuelen = XATTR_SIZE_MAX;
error = -libxfs_attr_get(&args);
if (error) {
dbprintf(_("failed to get attr %s on inode %llu: %s\n"),
args.name, (unsigned long long)iocur_top->ino,
strerror(error));
return error;
}
printf("%.*s=%.*s\n", namelen, print_name, args.valuelen,
(char *)args.value);
kfree(args.value);
return 0;
}
static int
attr_list_f(
int argc,
char **argv)
{
struct attrlist_ctx ctx = { };
struct xfs_trans *tp;
struct xfs_inode *ip;
int c;
int error;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "ruspvZ")) != EOF) {
switch (c) {
/* namespaces */
case 'Z':
ctx.fsprop = true;
fallthrough;
case 'r':
ctx.attr_filter &= ~LIBXFS_ATTR_NS;
ctx.attr_filter |= LIBXFS_ATTR_ROOT;
break;
case 'u':
ctx.attr_filter &= ~LIBXFS_ATTR_NS;
break;
case 's':
ctx.attr_filter &= ~LIBXFS_ATTR_NS;
ctx.attr_filter |= LIBXFS_ATTR_SECURE;
break;
case 'p':
ctx.attr_filter &= ~LIBXFS_ATTR_NS;
ctx.attr_filter |= XFS_ATTR_PARENT;
break;
case 'v':
ctx.print_values = true;
break;
default:
dbprintf(_("bad option for attr_list command\n"));
return 0;
}
}
if (ctx.fsprop &&
(ctx.attr_filter & LIBXFS_ATTR_NS) != LIBXFS_ATTR_ROOT) {
dbprintf(_("fs properties must be ATTR_ROOT\n"));
return false;
}
if (optind != argc) {
dbprintf(_("too many options for attr_list (no name needed)\n"));
return 0;
}
tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip);
if (error) {
dbprintf(_("failed to iget inode %llu: %s\n"),
(unsigned long long)iocur_top->ino,
strerror(error));
goto out_trans;
}
error = xattr_walk(tp, ip, attrlist_print, &ctx);
if (error) {
dbprintf(_("walking inode %llu xattrs: %s\n"),
(unsigned long long)iocur_top->ino,
strerror(error));
goto out_inode;
}
out_inode:
libxfs_irele(ip);
out_trans:
libxfs_trans_cancel(tp);
return 0;
}
|