-
Notifications
You must be signed in to change notification settings - Fork 19
Topic/syslog #29
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
Open
bhaskarv79
wants to merge
7
commits into
linux-msm:master
Choose a base branch
from
bhaskarv79:topic/syslog
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Topic/syslog #29
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0d10a53
tqftpserv: Compilation warnings break strict builds, fix -Wall -Werro…
bhaskarv79 a6b58e3
tqftpserv: Add Syslog-based logging system
bhaskarv79 7696d3f
tqftpserv: Add config file support for tqftpserv runtime configuration
bhaskarv79 eb773fa
tqftpserv: Enable syslog logging in tqftpserv
bhaskarv79 92566eb
tqftpserv: Enable config file support in tqftpserv
bhaskarv79 d2e90ce
tqftpserv: Add sample configuration file for tqftpserv
bhaskarv79 36d7557
tqftpserv: Add config file support for tqftpserv runtime configuration
bhaskarv79 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| #include "list.h" | ||
| #include "translate.h" | ||
| #include "logging.h" | ||
| #include "config.h" | ||
|
|
||
| #define MAX(x, y) ((x) > (y) ? (x) : (y)) | ||
|
|
||
|
|
@@ -603,7 +604,7 @@ static void client_close_and_free(struct tftp_client *client) | |
| free(client); | ||
| } | ||
|
|
||
| int main() | ||
| int main(int argc, char **argv) | ||
| { | ||
| struct tftp_client *client; | ||
| struct tftp_client *next; | ||
|
|
@@ -618,6 +619,27 @@ int main() | |
| int ret; | ||
| int fd; | ||
|
|
||
| /* Initialize configuration with defaults */ | ||
| tqftp_config_init_defaults(&tqftp_config); | ||
|
|
||
| /* Parse command line arguments */ | ||
| ret = tqftp_config_parse_args(argc, argv, &tqftp_config); | ||
| if (ret == 1) { | ||
| /* Help was shown */ | ||
| return 0; | ||
| } else if (ret < 0) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both conditional arms here are generally handled by one entity, which just calls exit(). |
||
| /* Error in arguments */ | ||
| return 1; | ||
| } | ||
|
|
||
| /* Initialize logging */ | ||
| tqftp_log_init_with_config(&tqftp_config.log_config); | ||
|
|
||
| TQFTP_LOG_INFO("TQFTP server starting"); | ||
| TQFTP_LOG_DEBUG("Configuration: readonly_path=%s, readwrite_path=%s, firmware_base=%s, temp_dir=%s", | ||
| tqftp_config.readonly_path, tqftp_config.readwrite_path, | ||
| tqftp_config.firmware_base, tqftp_config.temp_dir); | ||
|
|
||
| fd = qrtr_open(0); | ||
| if (fd < 0) { | ||
| TQFTP_LOG_ERR("failed to open qrtr socket"); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid adding a number of patches that builds up a bunch of functionality and then just throw it all in the mix at the end. If this change causes an issue, the bug is in any of the patches leading up to this change.
Also avoid doing multiple things in the patch itself. The commit message quite clearly tells that this adds config file support. (It also adds command line arguments, setting log level and other things, but you need to read the full patch to learn that)