LU-16723 parser: fix help hanging Running a command such as 'lctl pcc help v' will hang indefinitely. This is due to a bug in find_cmd, return pointers from two different arrays. This is fixed by setting top_level to be the concatenation of the override_cmdlist and the regular cmds. Also, rather than recursing forever, give up after reaching an arbitrary depth. Improve several help messages so that users will have a better idea why their commands aren't working. Fixes: 21080400f9 ("LU-16723 libcfs: refactor parser to be simpler") Test-Parameters: trivial Signed-off-by: Timothy Day <timday@amazon.com> Change-Id: Ib22bc71e5952b1beb868bbe37bc8f6b08c94ff72 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51339 Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com> Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-16723 libcfs: refactor parser to be simpler The parser code has a lot of unused complexity that can be streamlined. Refactor the parser makes the interface simpler from a development perspective and can provide a consistent user experience for all of the lustre utilities. All functions which are not used outside of the parser have been made static. Functions which don't appear to be used at all have been removed. The file headers have been standardized and the SDX text added. The function names have been changed to be more standard. Test-Parameters: testlist=sanity env=ONLY=60a,ONLY_REPEAT=10 Signed-off-by: Timothy Day <timday@amazon.com> Change-Id: I3354f213de424f51aef94c840083a4cb781d7aae Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50583 Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com> Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-16392 utils: use --list-commands for bash completion The CLI utils lctl and lfs currently use a pseudo option --non-existent-option to generate a list of completions. However, this was broken when the help output for an invalid command was changed. Using --list-commands instead means that the format of the help output can be kept succinct. However, currently there are 2 issues that make --list-commands unsuitable. First, --list-commands truncates long commands. This commit resolves this by not truncating long commands, and removing the fixed-length char buffer and writing directly to stdout so that the line length can overflow slightly if needed. Second, --list-commands recursively displays sub-commands. For example, for `lctl`, it will display `pcc add`, `pcc del`, etc in additon to just `pcc`. The bash completion tools would view these as separate tokens and thus would inappropriately suggest `add`, `del`, etc. as completions for `lctl`. This commit removes the recursive behavior. Removing the recursive behavior resolves an unrelated bug with the recursion that can be observed for `lctl`, where a number of top-level commands are skipped following recursion into a previous sub-command, equal to the number of subcommands processed in the recursive call. Specifically, the commands in the section "device setup", e.g. `attach`, `detach`, were not displayed following the recursive call into `pcc`. Finally, this commit changes the command parser to recognize --help and print the list of commands when this argument is seen. Fixes: bc69a8d058 ("LU-8621 utils: cmd help to stdout or short cmd error") Signed-off-by: Thomas Bertschinger <bertschinger@lanl.gov> Change-Id: Ib6e139402b9cd18e5a54b8fd3d6a2652d301e736 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49484 Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Vitaliy Kuznetsov <vkuznetsov@ddn.com> Reviewed-by: Oleg Drokin <green@whamcloud.com> Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com>
LU-15522 util: make readline() static In libcfs/libcfs/util/parser.c make readline() static to avoid conflicting with the real readline(). Test-Parameters: trivial Signed-off-by: John L. Hammond <jhammond@whamcloud.com> Change-Id: I4b90fd5d22c9fd5d193f5d18588afd3d97ca591c Reviewed-on: https://review.whamcloud.com/46465 Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com> Reviewed-by: Jian Yu <yujian@whamcloud.com> Reviewed-by: Mike Pershin <mpershin@whamcloud.com> Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-14487 libcfs: remove references to Sun Trademark. "lustre" is no longer a Trademark of Sun Microsystems. There is no need to acknowledge the trademark in every file, so just remove all these claims. Test-Parameters: trivial Signed-off-by: Mr NeilBrown <neilb@suse.de> Change-Id: Ife96ed8a26fd56a3c91933ae0a6b96784a8cc70a Reviewed-on: https://review.whamcloud.com/42137 Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: James Simmons <jsimmons@infradead.org>
LU-9538 utils: Tool for syncing file LSOM xattr Add a helper tool for syncing file LSOM xattr. Firstly, register a new changelog user: lctl --device lustre-MDT0000 changelog_register After perform some file operations on Lustre file system, run this tool to sync file LSOM xattr: llsom_sync -u cl1 -m lustre-MDT0000 /mnt/lustre Signed-off-by: Qian Yingjin <qian@ddn.com> Change-Id: Ia2878b48f7f665b01b230585921c78ae41846171 Reviewed-on: https://review.whamcloud.com/30124 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Li Xi <lixi@ddn.com> Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com> Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-10308 misc: update Intel copyright messages for 2017 Update copyright messages for files updated in 2016, excluding trivial patches. Add trivial patches to updatecw.sh script exclude list. Revert some changes that were incorrectly attributed to the 2016 (d10200a80770f0029d1d665af954187b9ad883df) and 2015 (0754bc8f2623bea184111af216f7567608db35b6) copyright update patches themselves, since they were not in the exclude list when the subsequent script was run. Test-Parameters: trivial Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Change-Id: I82f21c30c4dac75792bb49fc139bee2ca51f5545 Reviewed-on: https://review.whamcloud.com/30341 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Jian Yu <jian.yu@intel.com> Reviewed-by: James Nunez <james.a.nunez@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5170 utils: Add support for --list-commands option A --list-commands option has been added to lfs, lctl, lnetctl and lst to output a list of the commands supported by each utility. The commands are printed in a multi-column format to produce more compact output that is easier to read. The appropriate man pages have been updated to include the new options. The obsolete ACL and join commands have been removed from lfs. Signed-off-by: Steve Guminski <stephenx.guminski@intel.com> Change-Id: I3715049539c76e0cd03accfccfbf7eda6f4bf2ff Reviewed-on: https://review.whamcloud.com/24902 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com>
LU-8648 all: remove all Sun license and URL references The link to the GPL license at Sun is no longer there. Also Sun Inc is gone so lets remove all references to it in our source code. Test-Parameters: trivial Change-Id: Ib47d07dcef49a1ef624d0d8a4a91b9731f486278 Signed-off-by: James Simmons <uja.ornl@yahoo.com> Reviewed-on: http://review.whamcloud.com/22800 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Frank Zago <fzago@cray.com>
LU-6068 misc: update Intel copyright messages 2014 Update the copyright messages for changes made in 2014. In some cases, changes made in 2013 did not generate an updated copyright message, so these files are updated accordingly. In some cases there were no licenses on newly-added files, so add them (either with new copyrights, or including copyrights from the source files). Some types of changes that are not actually changing the code (e.g. whitespace, mass changes to add or remote prefixes, patches updating the copyright messages, patch reversions and the reverted patch, patches that only delete code, etc.) have been excluded. The updatecw.sh script was updated to fix a number of problems: - it now handles comments in nroff (man page) files properly - remove need to handle non-Intel copyrights specially - allow subdirectory to be specified on command-line - improve script debugging when running with "sh -vx" - print patches changing the most files, to catch mass replacements There are still a few cases that need to be fixed up by hand (e.g. files split up and "git log --follow" can't find the original). Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Change-Id: Ib4875400a4908dc79ddc8b82ab0fe3ee903ebbe5 Reviewed-on: http://review.whamcloud.com/13174 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2740 utils: Add support for --version option For mount.lustre, mkfs.lustre, lfs, and lctl, a --version option was added that will print the LUSTRE_VERSION_STRING. lctl has an option called lustre_build_version that prints both the Lustre version and the lctl version, which is BUILD_VERSION. Printing the lctl version was removed from the 'lctl lustre_build_version' output since BUILD_VERSION and LUSTRE_VERSION_STRING are very different strings and this could be confusing to the user. Also, mount.lustre and mkfs.lustre prints the version number when printing help/usage. This was removed to make all Lustre utilities have a more uniform output. The lctl, lfs and mkfs.lustre man pages were updated to include the --version option. Signed-off-by: James Nunez <james.a.nunez@intel.com> Change-Id: I301258562f51640f041dd7ac6aa695450270c385 Reviewed-on: http://review.whamcloud.com/11014 Tested-by: Jenkins Tested-by: Maloo <hpdd-maloo@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: John L. Hammond <john.hammond@intel.com>
LU-1347 build: remove the vim/emacs modelines Delete all of the vim/emacs modelines. Add copyright information for a few files. Signed-off-by: Liang Zhen <liang@whamcloud.com> Change-Id: Ic22ce8d8cc7786ffdb19937eb9f93a2d49aa2581 Reviewed-on: http://review.whamcloud.com/2658 Tested-by: Hudson Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Oleg Drokin <green@whamcloud.com>
Mass conversion of all copyright messages to Oracle.
b=16098 Add URL for GPLv2 license in copyright headers
Land b_head_libcfs onto HEAD (20080805_1722) b=16620 i=adilger i=shadow i=isaac First stage of Libcfs cleanup. This landing includes the patches from bugs 16159, 16420, 16445, 16478, and 16479.