Whamcloud - gitweb
LU-8945 ptlrpc : remove userland usage from ptlrpc 96/24396/4
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 27 Dec 2016 15:08:15 +0000 (10:08 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 18 Jan 2017 18:59:36 +0000 (18:59 +0000)
The reason for __REQ_LAYOUT_USER__ was to expose a
section of code in layout.c to userland for a utility
similar to wireshark. This was done before wireshark
existed but now that it does we no longer need to do
this type of hack. This also reduces lustre_acl.h to
strictly a kernel header now.

Test-Parameters: trivial

Change-Id: I649e36947789b8ebcb1204b65ac68b55a1d6ea49
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24396
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre.spec.in
lustre/include/lustre_acl.h
lustre/include/lustre_req_layout.h
lustre/ptlrpc/layout.c
lustre/utils/.gitignore
lustre/utils/Makefile.am
lustre/utils/req-layout.c [deleted file]

index b8d05bc..ef4c45f 100644 (file)
@@ -354,7 +354,6 @@ find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \;
 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
 echo '%{_bindir}/mcreate' >>lustre-tests.files
 echo '%{_bindir}/munlink' >>lustre-tests.files
-echo '%{_bindir}/req_layout' >>lustre-tests.files
 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
 echo '%{_sbindir}/wiretest' >>lustre-tests.files
 %endif
index e9928a2..92dba42 100644 (file)
 #ifndef _LUSTRE_ACL_H
 #define _LUSTRE_ACL_H
 
-#ifdef __KERNEL__
-# include <linux/fs.h>
-# include <linux/dcache.h>
-# ifdef CONFIG_FS_POSIX_ACL
-#  include <linux/posix_acl_xattr.h>
-#  define LUSTRE_POSIX_ACL_MAX_ENTRIES 32
-#  define LUSTRE_POSIX_ACL_MAX_SIZE                                    \
+#include <linux/fs.h>
+#include <linux/dcache.h>
+#ifdef CONFIG_FS_POSIX_ACL
+# include <linux/posix_acl_xattr.h>
+# define LUSTRE_POSIX_ACL_MAX_ENTRIES 32
+# define LUSTRE_POSIX_ACL_MAX_SIZE                                     \
        (sizeof(posix_acl_xattr_header) +                               \
         LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(posix_acl_xattr_entry))
-# endif /* CONFIG_FS_POSIX_ACL */
-#endif /* __KERNEL__ */
+#endif /* CONFIG_FS_POSIX_ACL */
 
 #ifndef LUSTRE_POSIX_ACL_MAX_SIZE
 # define LUSTRE_POSIX_ACL_MAX_SIZE 0
index 113b258..46e6fa8 100644 (file)
@@ -39,6 +39,8 @@
 #ifndef _LUSTRE_REQ_LAYOUT_H__
 #define _LUSTRE_REQ_LAYOUT_H__
 
+#include <linux/types.h>
+
 /** \defgroup req_layout req_layout
  *
  * @{
@@ -66,11 +68,6 @@ struct req_capsule {
         __u32                    rc_area[RCL_NR][REQ_MAX_FIELD_NR];
 };
 
-#if !defined(__REQ_LAYOUT_USER__)
-
-/* struct ptlrpc_request, lustre_msg* */
-#include <lustre_net.h>
-
 void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req,
                       enum req_location location);
 void req_capsule_fini(struct req_capsule *pill);
@@ -132,9 +129,6 @@ int req_capsule_server_grow(struct req_capsule *pill,
 int  req_layout_init(void);
 void req_layout_fini(void);
 
-/* __REQ_LAYOUT_USER__ */
-#endif
-
 extern struct req_format RQF_OBD_PING;
 extern struct req_format RQF_OBD_SET_INFO;
 extern struct req_format RQF_SEC_CTX;
index c469874..882be72 100644 (file)
@@ -42,8 +42,6 @@
  * of the format that the request conforms to.
  */
 
-#if !defined(__REQ_LAYOUT_USER__)
-
 #define DEBUG_SUBSYSTEM S_RPC
 
 #include <linux/module.h>
@@ -56,7 +54,6 @@
 #include <lustre_ver.h>
 #include <obd.h>
 #include <obd_support.h>
-#endif /* !__REQ_LAYOUT_USER__ */
 
 /* struct ptlrpc_request, lustre_msg* */
 #include <lustre_req_layout.h>
@@ -1727,8 +1724,6 @@ struct req_format RQF_OST_LADVISE =
        DEFINE_REQ_FMT0("OST_LADVISE", ost_ladvise, ost_body_only);
 EXPORT_SYMBOL(RQF_OST_LADVISE);
 
-#if !defined(__REQ_LAYOUT_USER__)
-
 /* Convenience macro */
 #define FMT_FIELD(fmt, i, j) (fmt)->rf_fields[(i)].d[(j)]
 
@@ -2546,5 +2541,3 @@ int req_capsule_server_grow(struct req_capsule *pill,
         return 0;
 }
 EXPORT_SYMBOL(req_capsule_server_grow);
-/* __REQ_LAYOUT_USER__ */
-#endif
index 05fa7c6..18103f9 100644 (file)
@@ -13,7 +13,6 @@
 /llverdev
 /l_getidentity
 /l_facl
-/req_layout
 /mkfs_lustre
 /mount_lustre
 /tunefs_lustre
index e0b6631..45eba70 100644 (file)
@@ -37,7 +37,6 @@ sbin_SCRIPTS  = ldlm_debug_upcall
 sbin_PROGRAMS = lctl l_getidentity llverfs lustre_rsync ll_decode_linkea
 
 if TESTS
-bin_PROGRAMS  += req_layout
 sbin_PROGRAMS += wiretest
 endif # TESTS
 
@@ -121,8 +120,6 @@ if LDISKFS_ENABLED
 libiam_a_SOURCES = libiam.c
 endif
 
-req_layout_SOURCES = req-layout.c
-
 llog_reader_SOURCES = llog_reader.c
 llog_reader_LDADD := $(LIBPTLCTL) liblustreapi.a
 llog_reader_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a
diff --git a/lustre/utils/req-layout.c b/lustre/utils/req-layout.c
deleted file mode 100644 (file)
index 2ff41b5..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2016, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/utils/req-layout.c
- *
- * User-level tool for printing request layouts
- *
- * Author: Nikita Danilov <nikita@clusterfs.com>
- */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <linux/types.h>
-
-#define __REQ_LAYOUT_USER__ (1)
-#define EXPORT_SYMBOL(s)
-
-#include <lustre/lustre_idl.h>
-#include <lustre_req_layout.h>
-#include <lustre/lustreapi.h>
-
-#ifndef ARRAY_SIZE
-# define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
-#endif /* !ARRAY_SIZE */
-
-#define lustre_swab_generic_32s NULL
-#define lustre_swab_lu_seq_range NULL
-#define lustre_swab_mdt_body NULL
-#define lustre_swab_mdt_ioepoch NULL
-#define lustre_swab_ptlrpc_body NULL
-#define lustre_swab_obd_statfs NULL
-#define lustre_swab_connect NULL
-#define lustre_swab_ldlm_request NULL
-#define lustre_swab_ldlm_reply NULL
-#define lustre_swab_ldlm_intent NULL
-#define lustre_swab_layout_intent NULL
-/* #define lustre_swab_lov_mds_md NULL */
-#define lustre_swab_mdt_rec_reint NULL
-#define lustre_swab_lustre_capa NULL
-#define lustre_swab_lustre_capa_key NULL
-#define lustre_swab_llogd_conn_body NULL
-#define lustre_swab_llog_hdr NULL
-#define lustre_swab_llogd_body NULL
-#define lustre_swab_obd_quotactl NULL
-#define lustre_swab_mgs_target_info NULL
-#define lustre_swab_niobuf_remote NULL
-#define lustre_swab_obd_ioobj NULL
-#define lustre_swab_ost_body NULL
-#define lustre_swab_ost_last_id NULL
-#define lustre_swab_fiemap NULL
-#define lustre_swab_idx_info NULL
-#define lustre_swab_qdata NULL
-#define lustre_swab_quota_body NULL
-#define lustre_swab_ost_lvb_v1 NULL
-#define lustre_swab_ost_lvb NULL
-#define lustre_swab_gl_desc NULL
-#define lustre_swab_mgs_config_body NULL
-#define lustre_swab_mgs_config_res NULL
-#define lustre_swab_swap_layouts NULL
-#define lustre_swab_lu_fid NULL
-#define lustre_swab_ost_id NULL
-#define lustre_swab_hsm_progress_kernel NULL
-#define lustre_swab_hsm_user_item NULL
-#define lustre_swab_hsm_user_state NULL
-#define lustre_swab_hsm_state_set NULL
-#define lustre_swab_hsm_current_action NULL
-#define lustre_swab_hsm_request NULL
-#define lustre_swab_close_data NULL
-#define lustre_swab_object_update NULL
-#define lustre_swab_object_update_result NULL
-#define lustre_swab_object_update_reply NULL
-#define lustre_swab_object_update_request NULL
-#define lustre_swab_out_update_header NULL
-#define lustre_swab_out_update_buffer NULL
-
-#define dump_rniobuf NULL
-#define dump_ioo NULL
-#define dump_obdo NULL
-#define dump_ost_body NULL
-#define dump_rcs NULL
-#define lustre_swab_lmv_user_md NULL
-#define lustre_swab_lfsck_request NULL
-#define lustre_swab_lfsck_reply NULL
-#define lustre_swab_ladvise_hdr NULL
-#define lustre_swab_ladvise NULL
-
-/*
- * Yes, include .c file.
- */
-#include "../ptlrpc/layout.c"
-
-void usage(void)
-{
-        fprintf(stderr, "req-layout -- prints lustre request layouts\n");
-}
-
-void printt_field(const char *prefix, const struct req_msg_field *fld)
-{
-}
-
-void print_layout(const struct req_format *rf)
-{
-        int j;
-        int k;
-
-        int offset;
-        int variable;
-
-        static const char *prefix[RCL_NR] = {
-                [RCL_CLIENT] = "C",
-                [RCL_SERVER] = "S"
-        };
-
-       printf("L %s (%zu/%zu)\n", rf->rf_name,
-               rf->rf_fields[RCL_CLIENT].nr, rf->rf_fields[RCL_SERVER].nr);
-
-        for (j = 0; j < RCL_NR; ++j) {
-                offset = 0;
-                variable = 0;
-                for (k = 0; k < rf->rf_fields[j].nr; ++k) {
-                        const struct req_msg_field *fld;
-
-                        fld = rf->rf_fields[j].d[k];
-
-                        printf("        F%s %i [%3.3i%s %-20.20s (",
-                               prefix[j], k, offset,
-                               variable ? " + ...]" : "]      ",
-                               fld->rmf_name);
-                        if (fld->rmf_size > 0) {
-                                printf("%3.3i) ", fld->rmf_size);
-                                offset += fld->rmf_size;
-                        } else {
-                                printf("var) ");
-                                variable = 1;
-                        }
-                        if (fld->rmf_flags & RMF_F_STRING)
-                                printf("string");
-                        printf("\n");
-                }
-                if (k > 0 && j != RCL_NR - 1)
-                        printf("        -----------------------------------\n");
-        }
-}
-
-void print_layouts(void)
-{
-        int i;
-
-        for (i = 0; i < ARRAY_SIZE(req_formats); ++i) {
-                print_layout(req_formats[i]);
-                printf("\n");
-        }
-}
-
-int main(int argc, char **argv)
-{
-        int opt;
-        int verbose;
-
-        verbose = 0;
-        do {
-                opt = getopt(argc, argv, "hb:k:r:p:v");
-                switch (opt) {
-                case 'v':
-                        verbose++;
-                case -1:
-                        break;
-                case '?':
-                default:
-                        fprintf(stderr, "Unable to parse options.");
-                case 'h':
-                        usage();
-                        return 0;
-                }
-        } while (opt != -1);
-        print_layouts();
-        return 0;
-}