1    	// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
2    	// vim: ts=8 sw=2 smarttab
3    	/*
4    	 * Ceph - scalable distributed file system
5    	 *
6    	 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7    	 *
8    	 * This is free software; you can redistribute it and/or
9    	 * modify it under the terms of the GNU Lesser General Public
10   	 * License version 2.1, as published by the Free Software 
11   	 * Foundation.  See file COPYING.
12   	 * 
13   	 */
14   	
15   	#ifndef CEPH_MCLIENTSESSION_H
16   	#define CEPH_MCLIENTSESSION_H
17   	
18   	#include "msg/Message.h"
19   	#include "mds/mdstypes.h"
20   	
21   	class MClientSession : public Message {
22   	private:
23   	  static constexpr int HEAD_VERSION = 3;
24   	  static constexpr int COMPAT_VERSION = 1;
25   	
26   	public:
27   	  ceph_mds_session_head head;
28   	
29   	  std::map<std::string, std::string> metadata;
30   	  feature_bitset_t supported_features;
31   	
32   	  int get_op() const { return head.op; }
33   	  version_t get_seq() const { return head.seq; }
34   	  utime_t get_stamp() const { return utime_t(head.stamp); }
35   	  int get_max_caps() const { return head.max_caps; }
36   	  int get_max_leases() const { return head.max_leases; }
37   	
38   	protected:
(2) Event uninit_member: Non-static class member field "head.op" is not initialized in this constructor nor in any functions that it calls.
(4) Event uninit_member: Non-static class member field "head.seq" is not initialized in this constructor nor in any functions that it calls.
(6) Event uninit_member: Non-static class member field "head.stamp" is not initialized in this constructor nor in any functions that it calls.
(8) Event uninit_member: Non-static class member field "head.max_caps" is not initialized in this constructor nor in any functions that it calls.
(10) Event uninit_member: Non-static class member field "head.max_leases" is not initialized in this constructor nor in any functions that it calls.
Also see events: [member_decl][member_decl][member_decl][member_decl][member_decl]
39   	  MClientSession() : Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} { }
40   	  MClientSession(int o, version_t s=0) : 
41   	    Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} {
42   	    memset(&head, 0, sizeof(head));
43   	    head.op = o;
44   	    head.seq = s;
45   	  }
46   	  MClientSession(int o, utime_t st) : 
47   	    Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} {
48   	    memset(&head, 0, sizeof(head));
49   	    head.op = o;
50   	    head.seq = 0;
51   	    st.encode_timeval(&head.stamp);
52   	  }
53   	  ~MClientSession() override {}
54   	
55   	public:
56   	  std::string_view get_type_name() const override { return "client_session"; }
57   	  void print(ostream& out) const override {
58   	    out << "client_session(" << ceph_session_op_name(get_op());
59   	    if (get_seq())
60   	      out << " seq " << get_seq();
61   	    if (get_op() == CEPH_SESSION_RECALL_STATE)
62   	      out << " max_caps " << head.max_caps << " max_leases " << head.max_leases;
63   	    out << ")";
64   	  }
65   	
66   	  void decode_payload() override { 
67   	    auto p = payload.cbegin();
68   	    decode(head, p);
69   	    if (header.version >= 2)
70   	      decode(metadata, p);
71   	    if (header.version >= 3)
72   	      decode(supported_features, p);
73   	  }
74   	  void encode_payload(uint64_t features) override { 
75   	    using ceph::encode;
76   	    encode(head, payload);
77   	    if (metadata.empty() && supported_features.empty()) {
78   	      // If we're not trying to send any metadata (always the case if
79   	      // we are a server) then send older-format message to avoid upsetting
80   	      // old kernel clients.
81   	      header.version = 1;
82   	    } else {
83   	      header.version = HEAD_VERSION;
84   	      encode(metadata, payload);
85   	      encode(supported_features, payload);
86   	    }
87   	  }
88   	private:
89   	  template<class T, typename... Args>
90   	  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
91   	};
92   	
93   	#endif
94