X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fll_decode_filter_fid.c;h=00de58e03d7ae29cc7b061553ae18d4062f5ac18;hb=81aa70a14c7dcadd593ed987d3f92bd05d120a0f;hp=c5a0c54fd1d421dc42be0e9011b8dc5ad023360a;hpb=65701b4a30efdb695776bcf690a2b3cabc928da1;p=fs%2Flustre-release.git diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index c5a0c54..00de58e 100644 --- a/lustre/utils/ll_decode_filter_fid.c +++ b/lustre/utils/ll_decode_filter_fid.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +27,7 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Whamcloud, Inc. + * Copyright (c) 2011, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -48,7 +46,7 @@ #include #include #include -#include +#include #include int main(int argc, char *argv[]) @@ -61,24 +59,37 @@ int main(int argc, char *argv[]) struct filter_fid *ff = (void *)buf; int size; - size = getxattr(argv[i], "trusted.fid", buf, sizeof(buf)); + size = getxattr(argv[i], "trusted.fid", buf, + sizeof(struct filter_fid_old)); if (size < 0) { fprintf(stderr, "%s: error reading fid: %s\n", argv[i], strerror(errno)); if (rc == 0) rc = size; - continue; - } - if (size > sizeof(*ff)) - fprintf(stderr, "%s: warning: fid larger than expected " - "(%d bytes), recompile?\n", argv[i], size); + continue; + } + if (size > sizeof(struct filter_fid_old)) { + fprintf(stderr, "%s: warning: fid larger than expected" + " (%d bytes), recompile?\n", argv[i], size); + } else if (size > sizeof(*ff)) { + struct filter_fid_old *ffo = (void *)buf; - printf("%s: objid="LPU64" seq="LPU64" parent="DFID"\n", - argv[i], le64_to_cpu(ff->ff_objid), - le64_to_cpu(ff->ff_seq), - le64_to_cpu(ff->ff_parent.f_seq), - le32_to_cpu(ff->ff_parent.f_oid), - le32_to_cpu(ff->ff_parent.f_ver)); + /* old filter_fid */ + printf("%s: objid=%llu seq=%llu parent="DFID + " stripe=%u\n", argv[i], + (unsigned long long)le64_to_cpu(ffo->ff_objid), + (unsigned long long)le64_to_cpu(ffo->ff_seq), + (unsigned long long)le64_to_cpu(ffo->ff_parent.f_seq), + le32_to_cpu(ffo->ff_parent.f_oid), 0 /* ver */, + /* this is stripe_nr actually */ + le32_to_cpu(ffo->ff_parent.f_stripe_idx)); + } else { + printf("%s: parent="DFID" stripe=%u\n", argv[i], + (unsigned long long)le64_to_cpu(ff->ff_parent.f_seq), + le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */ + /* this is stripe_nr actually */ + le32_to_cpu(ff->ff_parent.f_stripe_idx)); + } } return rc;