X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fll_decode_filter_fid.c;h=8eb7b666abc7f45e4e586e7359feb62965c0654b;hp=a394a4c9ec7623d6d5126c96f2f6ec9c2df9015d;hb=e8965be4e135b55f0a900446e4a1c74905eaccd1;hpb=a5b81807c5d6d2cb3b2ef1a0a7e150ee6002f7f7 diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index a394a4c..8eb7b66 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. @@ -28,6 +26,8 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include int main(int argc, char *argv[]) @@ -59,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), + le32toh(ffo->ff_parent.f_oid), 0 /* ver */, + /* this is stripe_nr actually */ + le32toh(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;