Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement InitHeader call in CFE FS #37

Closed
skliper opened this issue Sep 30, 2019 · 11 comments
Closed

Implement InitHeader call in CFE FS #37

skliper opened this issue Sep 30, 2019 · 11 comments
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 30, 2019

All CFE apps that write a file should prefix that file with a header object defined in FS. Currently they do so on-the-fly by simply memset()'ing the structure to zero and setting a key field.

This should be cleaned up and moved to an InitHeader() call in CFE FS such that if fields need to be added to the header in the future this can be done without having to touch many different places where the header is initialized/written.

@skliper skliper added this to the 6.5.0 milestone Sep 30, 2019
@skliper skliper self-assigned this Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Imported from trac issue 6. Created by jphickey on 2014-12-24T08:51:08, last modified: 2019-03-05T14:57:55

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by jphickey on 2014-12-24 11:14:18:

Pushed commit [changeset:de8f127] to address this.

NOTE: In several instances this change also fixes possible uninitialized data bug(s): the file header was allocated on the stack but not necessarily memset() before writing it to the file. The description and subtype were set, but other fields might have uninitialized data.

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by jphickey on 2015-04-06 11:22:20:

This is ready for review/merge

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by acudmore on 2015-04-06 14:03:55:

recommend accept

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by jwilmot on 2015-04-06 15:17:42:

Should the Init header function return an error code? What if the string is to long? How would an app add non-common header metadata like a version or CRC?

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by jphickey on 2015-04-06 15:46:57:

We can easily modify the API to return an int32 and do the length check, but we just need to consider:

  • Nothing was being length-checked previously with the existing code, strings would have just been silently truncated. The way it is now preserves the silent-truncation behavior, so as to minimize the chance of unintended consequences.
  • Nothing will be actually checking the return code on this (yet), and adding this check will complicate all the users of this function since they need a failure path, unit tests for the failure path, etc.

For the case of non-common header data, the callers are still free to modify the structure after this call returns, just as they always have done. This only replaces the bits of initialization that were consistent everywhere. It also creates a nice place for future additions of things that need to be everywhere (such as the signature of EDS in use describing the binary format).

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by glimes on 2015-04-07 12:47:34:

Tested changeset [changeset:de8f127] as part of the ic-2015-03-10 merge.
Do we include this changeset as-is (and update later), defer it, or revise
it as part of this merge?

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by sstrege on 2015-04-07 13:25:39:

CCB - Agree to move this change forward and open a new ticket to handle error/length conditions

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by glimes on 2015-04-13 15:26:51:

Part of integration candidate 2015-03-10,
committed to cFS CFE Development branch on 2015-04-10
as part of merge [changeset:7d6f6d0].

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by glimes on 2016-02-16 13:16:45:

Susie confirmed these tickets have been approved for CFE 6.5

@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Trac comment by jhageman on 2019-03-05 14:57:55:

Milestone renamed

@skliper skliper closed this as completed Sep 30, 2019
@skliper skliper removed their assignment Sep 30, 2019
dmknutsen pushed a commit that referenced this issue Jan 23, 2020
dmknutsen pushed a commit that referenced this issue Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant