misc: Replace license blurb with kernel-style SPDX markers

This was roughly achieved by the following shell script:

$ git ls-files |
	grep '\.[ch]p*$' |
	while read F; do EXT=${F##*.}; cat spdx.$EXT <(sed '/^\/\*$/,/^ \*\/$/d' $F) > ${F}.tmp; mv ${F}.tmp $F; done

With the following context:

$ cat spdx.c
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
$ cat spdx.h
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */
$ ls -l spdx.*
-rw-r--r-- 1 andrew andrew 71 Feb 27 12:02 spdx.c
lrwxrwxrwx 1 andrew andrew  6 Feb 27 12:02 spdx.cpp -> spdx.c
-rw-r--r-- 1 andrew andrew 77 Feb 27 12:02 spdx.h
lrwxrwxrwx 1 andrew andrew  6 Feb 27 12:02 spdx.hpp -> spdx.h

The `sed` invocation catches a lot of function documentation, so the
hunks were manually added to avoid removing information that we want to
keep.

Change-Id: I63e49ca2593aa0db0568c7a63bfdead388642e76
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
59 files changed
tree: f4549207697663ff5e2dc8fc6e01e098dcf5d66c
  1. Documentation/
  2. m4/
  3. test/
  4. xyz/
  5. .clang-format-c
  6. .clang-format-c++
  7. .gitignore
  8. bootstrap.sh
  9. common.c
  10. common.h
  11. configure.ac
  12. dbus.h
  13. format-code.sh
  14. LICENSE
  15. Makefile.am
  16. mbox.h
  17. mboxctl.c
  18. mboxd.c
  19. mboxd_dbus.c
  20. mboxd_dbus.h
  21. mboxd_flash.h
  22. mboxd_flash_physical.c
  23. mboxd_flash_virtual.cpp
  24. mboxd_lpc.c
  25. mboxd_lpc.h
  26. mboxd_lpc_physical.c
  27. mboxd_lpc_virtual.cpp
  28. mboxd_msg.c
  29. mboxd_msg.h
  30. mboxd_pnor_partition_table.cpp
  31. mboxd_pnor_partition_table.h
  32. mboxd_windows.c
  33. mboxd_windows.h
  34. mtd.c
  35. pnor_partition.cpp
  36. pnor_partition.hpp
  37. pnor_partition_defs.h
  38. pnor_partition_table.cpp
  39. pnor_partition_table.hpp
  40. README.md
README.md

Copyright 2017 IBM

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

MBOX

This repo contains the protocol definition for the host to BMC mailbox communication specification which can be found in Documentation/mbox_procotol.md.

There is also a reference implementation of a BMC mailbox daemon, the details of which can be found in Documentation/mboxd.md.

Finally there is also an implementation of a mailbox daemon control program, the details of which can be found in Documentation/mboxctl.md.

Style Guide

Preamble

This codebase is a mix of C (due to its heritage) and C++. This is an ugly split: message logging and error handling can be vastly different inside the same codebase. The aim is to remove the split one way or the other over time and have consistent approaches to solving problems.

phosphor-mboxd is developed as part of the OpenBMC project, which also leads to integration of frameworks such as phosphor-logging. Specifically on phosphor-logging, it's noted that without care we can achieve absurd duplication or irritating splits in where errors are reported, as the C code is not capable of making use of the interfaces provided.

Rules

  1. Message logging MUST be done to stdout or stderr, and MUST NOT be done directly via journal APIs or wrappers of the journal APIs.

    Rationale:

    We have two scenarios where we care about output, with the important restriction that the method must be consistent between C and C++:

    1. Running in-context on an OpenBMC-based system
    2. Running the test suite

    In the first case it is desirable that the messages appear in the system journal. To this end, systemd will by default capture stdout and stderr of the launched binary and redirect it to the journal.

    In the second case it is desirable that messages be captured by the test runner (make check) for test failure analysis, and it is undesirable for messages to appear in the system journal (as these are tests, not issues affecting the health of the system they are being executed on).

    Therefore direct calls to the journal MUST be avoided for the purpose of message logging.

    Note: This section specifically targets the use of phosphor-logging's log<T>(). It does not prevent the use of elog<T>().