X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fll_decode_filter_fid.c;h=809e994074ef6bd6a248c431d22341af9273c763;hb=ea383222e031cdceffbdf2e3afab3b6d1fd53c8e;hp=c7e2c63b79e1675f2142880969983818d417da2c;hpb=48ee13b5eef97e0deaf3832e37b08df9cddf825f;p=fs%2Flustre-release.git diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index c7e2c63..809e994 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. @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved + * 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,40 +46,50 @@ #include #include #include -#include +#include #include int main(int argc, char *argv[]) { - char *prog; int rc = 0; int i; - prog = basename(argv[0]); - for (i = 1; i < argc; i++) { char buf[1024]; /* allow xattr that may be larger */ 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=%llu seq=%llu 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="LPU64" seq="LPU64" parent="DFID + " stripe=%u\n", argv[i], + le64_to_cpu(ffo->ff_objid), + le64_to_cpu(ffo->ff_seq), + 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], + 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;