-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: master
Are you sure you want to change the base?
Topic/syslog #29
Conversation
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.
All commit messages should start with the description of an issue: 'Foo ABC is bad, change it to be BAR.'
meson.build
Outdated
tqftpserv_srcs, | ||
dependencies : [qrtr_dep, zstd_dep], | ||
dependencies : [qrtr, zstd_dep], | ||
c_args : ['-g', '-Wall', '-Werror', '-Wsign-compare', '-Wunused-parameter', '-Wtype-limits', '-Wimplicit-function-declaration'], |
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.
This is obviosly an abuse of dependencies and it might break for non-gcc compilers. Please use add_global_arguments to add build options.
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.
I added arguments using add_project_arguments
tqftpserv.c
Outdated
} | ||
|
||
if (tsize && *tsize != -1) { | ||
if (tsize && *tsize != (size_t)-1) { |
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.
Change tsize to ssize_t
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.
Done
tqftpserv.c
Outdated
/* Header (4 bytes) + data size */ | ||
send_len = 4 + response_size; | ||
if (send_len > p - buf) { | ||
if (send_len > (size_t)(p - buf)) { |
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.
ptrdiff_t
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.
changed send_len from size_t to ssize_t
*/ | ||
|
||
/* For memfd_create */ | ||
#define _GNU_SOURCE |
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.
Why? it was fine as is and it's not related to warnings
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.
This macro needs to be defined for asprintf function usage in translate.c, so I moved it to meson.build
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.
Please move it back and add another one in translate.c
} | ||
|
||
if (write(output_file_fd, decompressed_buffer, decompressed_size) != decompressed_size) { | ||
if (write(output_file_fd, decompressed_buffer, decompressed_size) != (ssize_t)decompressed_size) { |
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.
Change decompressed_size to size_t or ssize_t.
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.
Done
logging.c
Outdated
* | ||
* Return: Log facility constant on success, -1 on error | ||
*/ | ||
int tqftp_parse_log_facility(const char *facility_str) |
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.
Always use daemon, no need to let it be logged as "uucp".
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.
Done
* tqftp_log_init_with_config() - Initialize logging with custom configuration | ||
* @config: Logging configuration structure | ||
*/ | ||
void tqftp_log_init_with_config(struct tqftp_log_config *config) |
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.
I'd suggest using function calls instead of passing config around. I.e. set_min_level, use_console, etc.
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.
configuration file will allow to run the server on various linux flavors without changing the server code. I added configuration support for command line arguments as well, I will remove them and have server access paths only.
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.
Why? It's really easier to parse few command line options rather than having a config file parser.
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.
We can add command line option, if we want to change the paths (based on the build type, android, LE, Ubuntu, etc) then we have to modify service file (or equivalent) that starts the server and this service file needs to be created based on variant.
With configuration file as well it would be similar (multiple configuration files) however, config files can be modified in on the fly for debugging. There are other tuning parameters that needs to be introduced, so I thought configuration file would be better than adding too many command line arguments.
Lets discuss which is better.
* | ||
* Return: 0 on success, -1 on error | ||
*/ | ||
int tqftp_config_load_file(struct tqftp_config *config, const char *filename) |
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.
Yikes. If you want to have a config file, use one of existing libraries. I'd recommend libconfig. Or just use command line options.
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.
I tried using libconfig and it is not available for all builds, does it make sense to copy libconfig in this project (I don't like this though)?
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.
No, it doesn't. What do you mean by it 'being not available for all builds'?
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.
'What do you mean by it 'being not available for all builds'?
I attempted to build on Android flavor and it failed, I did some experiments and understood that libconfig is present and it needed to be enabled from base config file. I have used libconfig and posted new change.
logging.h
Outdated
|
||
/* Convenience macros for common logging patterns */ | ||
#define TQFTP_LOG_ERROR(fmt, ...) TQFTP_LOG_ERR(fmt, ##__VA_ARGS__) | ||
#define TQFTP_LOG_WARN(fmt, ...) TQFTP_LOG_WARNING(fmt, ##__VA_ARGS__) |
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.
Why do we need these duplicates? Select one style and use it.
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.
Done
logging.h
Outdated
#define TQFTP_LOG_PERROR(msg) TQFTP_LOG_ERR("%s: %s", msg, strerror(errno)) | ||
|
||
/* Macro to log system errors with custom format */ | ||
#define TQFTP_LOG_ERRNO(fmt, ...) TQFTP_LOG_ERR(fmt ": %s", ##__VA_ARGS__, strerror(errno)) |
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.
Again, select one style instead of having two very similar ones.
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.
Done
…r issues Resolve multiple compilation issues triggered by -Wall and -Werror flags: - Multiple warnings in in zstd_decompress_file function in zstd-decompress.h. - Eliminate redefinition of zstd_decompress_file between zstd-decompress.h and zstd-decompress.c. - Address pointer type mismatch in tqftpserv.c by correcting char * vs uint8_t * assignment. - Resolve signedness comparison issues in tqftpserv.c for send_len and tsize checks. - Remove unused parameters argc and argv in main() function of tqftpserv.c. These changes ensure clean compilation and adherence to strict warning policies. Change-Id: I1539433ec5122e0e6fc3c8e0d02900a040bc21de Signed-off-by: Bhaskar Valaboju <[email protected]>
Introduce a project-specific logging framework through syslog. Change-Id: Ie3399a58e9772f25979471cbf2f861ad1962d788 Signed-off-by: Bhaskar Valaboju <[email protected]>
Integrate configuration management via config file and command-line arguments to customize server behavior. This allows runtime configuration of key filesystem paths including readonly_path, readwrite_path, firmware_base, updates_dir, and temp_dir. It also enables dynamic adjustment of the default log level, supporting flexible deployment across platforms like Linux and Android without requiring code changes. Change-Id: I788ce0eb1052f43872800bc0f2e0cc5d0a6b442b Signed-off-by: Bhaskar Valaboju <[email protected]>
Integrate syslog-based logging into tqftpserv source files. Logging now leverages system-level facilities for consistent output and easier debugging. Signed-off-by: Bhaskar Valaboju <[email protected]>
Integrate configuration management via config file and command-line arguments to customize server behavior. This allows runtime configuration of key filesystem paths including readonly_path, readwrite_path, firmware_base, updates_dir, and temp_dir. It also enables dynamic adjustment of the default log level, supporting flexible deployment across platforms like Linux and Android without requiring code changes. Signed-off-by: Bhaskar Valaboju <[email protected]>
Provide a sample configuration file to support runtime customization of server paths and log level settings. Signed-off-by: Bhaskar Valaboju <[email protected]>
4551b96
to
d2e90ce
Compare
I addressed all the comments, it took time to validate on all flavors. |
Integrate configuration management via config file and command-line arguments to customize server behavior. This allows runtime configuration of key filesystem paths including readonly_path, readwrite_path, firmware_base, updates_dir, and temp_dir. It also enables dynamic adjustment of the default log level, supporting flexible deployment across platforms like Linux and Android without requiring code changes. Change-Id: I788ce0eb1052f43872800bc0f2e0cc5d0a6b442b Signed-off-by: Bhaskar Valaboju <[email protected]>
Gentle Remainder!!! |
Gentle Remainder !!! |
Gentle Remainder, @lumag |
Request to merge below changes: