Merge lp:~xnox/upstart/overrides into lp:upstart
| Status: | Merged |
|---|---|
| Merged at revision: | 1423 |
| Proposed branch: | lp:~xnox/upstart/overrides |
| Merge into: | lp:upstart |
| Diff against target: |
814 lines (+484/-160) 4 files modified
ChangeLog (+8/-0) init/conf.c (+212/-157) init/tests/test_conf.c (+119/-1) init/tests/test_conf_static.c (+145/-2) |
| To merge this branch: | bzr merge lp:~xnox/upstart/overrides |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| James Hunt | 2013-01-04 | Approve on 2013-01-08 | |
|
Review via email:
|
|||
Description of the Change
This branch implements override files from any directory as specified here [1].
Instead of checking for a known path to .override file, a helper function `conf_get_
Next, I refactored another helper function conf_load_
For the handlers we now have the following logic:
- if a .conf file is created/modified: simply call conf_load_
- if a .override file is created/
- if a .conf file is deleted: the behaviour is the same, unref the file from the ConfSource.
For system init, there shouldn't be much performance impact since there is only one directory to do lookups in.
For session init, most jobs will be in the lowest priority config_source. Thus resulting in lstat call in each config_source for each job to check for an .override file. But in practice, those higher priority config_sources may not even exist and lstat calls on non-existing directories is cheap. Potentially this can be micro-optimised by storing hashes of all found .override files while walking the config_sources and then instead of lstat check do a hash lookup...
- 1424. By Dimitri John Ledkov on 2013-01-08
-
Review comments
| Dimitri John Ledkov (xnox) wrote : | # |
Addressed all comments.
Checking return status of nih_sprintf with NIH_MUST.
Converted conf_source_
- 1425. By Dimitri John Ledkov on 2013-01-08
-
;


Hi Dmitrijs,
* Changelog: Need extra indent for 'priority' and 'correctly'. best_override( ): reload_ file() is still using stat(2) so path_with_ override( ): modify_ handler( ): handler( ):
* init/conf.c:
- Might just as well add ',2013' to copyright now :)
- conf_to_job_name():
- Typo: 'ConfigSource' should be 'ConfSource'.
- Typo: 'from then' should be 'from the'.
- You could drop the braces for the final if/else test, but they
were there originally I guess :)
- conf_get_
- Typo: '& finds the' should be '& find the'.
- Typo: 'for override file' should be 'for override files'.
- Typo: 'ConfigSource' should be 'ConfSource'.
- @name and @last_source are not asserted.
- Using lstat(2) seems correct since we don't support symlinks on
purpose, but conf_source_
there is a discrepancy.
- conf_load_
- Need space around '=' in initial assignments.
- 'if (override_path)' at line 818 technically redundant since we already know it
cannot be NULL.
- conf_create_
- Missing check on return from nih_sprintf().
- conf_delete_
- Typo: 'overide' rather than 'override'.
Regarding your comments on the lstat issue, we need to keep an eye on this. As you say, the impact should not be great, but it would still be worth performing some tests on a slow system to see if the new code makes any appreciable difference to performance.