summaryrefslogtreecommitdiff
path: root/src/udev/scsi_id
AgeCommit message (Collapse)AuthorFilesLines
2019-11-04tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2-2/+0
2019-07-12tree-wide: some more [static] related fixesLennart Poettering1-0/+3
let's add [static] where it was missing so far Drop [static] on parameters that can be NULL. Add an assert() around parameters that have [static] and can't be NULL hence. Add some "const" where it was forgotten.
2019-05-22udev/scsi_id: fix incorrect page length when get device identification VPD pageZhang Xianwei1-1/+1
The length of device identification VPD page is filled with two bytes, but scsi_id only gets the low byte. Fix it. Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
2019-05-07scsi_serial: replace some crazy strncpy() calls by strnlen()Zbigniew Jędrzejewski-Szmek1-21/+15
gcc was warning about strncpy() leaving an unterminated string. In this case, it was correct. The code was doing strncpy()+strncat()+strlen() essentially to determine if the strings have expected length. If the length was correct, a buffer overread was performed (or at least some garbage bytes were used from the uninitialized part of the buffer). Let's do the length check first and then only copy stuff if everything agrees. For some reason the function was called "prepend", when it obviously does an "append".
2019-05-07scsi_serial: replace &foo[n] by foo+nZbigniew Jędrzejewski-Szmek1-9/+9
2019-04-30udev: drop unnecessary bracketsYu Watanabe2-22/+14
Follow-up for ed0cb346821972ec2c505ee11ed3d383aba6256e.
2019-04-30tree-wide: code improvements suggested by CoccinelleFrantisek Sumsal2-27/+35
2019-04-28tree-wide: replace explicit NULL checks with their shorter variantsFrantisek Sumsal2-6/+6
Done by coccinelle/equals-null.cocci
2019-03-13util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering1-1/+1
Just some source rearranging.
2018-12-21meson: generate version tag from gitZbigniew Jędrzejewski-Szmek1-1/+2
$ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
2018-11-21udev/scsi_id: fix buffer lengthYu Watanabe1-6/+6
2018-11-20libudev-list: move libudev-list related definitions to libudev-list-internal.hYu Watanabe1-1/+2
This also rename libudev-private.h to libudev-util.h, and cleanups several unnecessary headers from udev.h and libudev-util.h
2018-10-19tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2-8/+8
2018-09-10udev/scsi_id: drop never used code blocksYu Watanabe1-15/+0
2018-09-10udev/scsi_id: coding style fixesYu Watanabe1-6/+3
2018-09-10udev/scsi_id: drop unused udev structYu Watanabe3-122/+71
2018-08-23udev: move udev cleanup functions from udev-util.h to udev.hYu Watanabe1-0/+1
2018-07-23tree-wide: drop empty lines in commentsYu Watanabe3-3/+0
2018-06-19scsi_id: Fixup prefix for pre-SPC inquiry replyHannes Reinecke1-2/+2
The prefix for EMC Symmetrix pre-SPC VPD inquiry reply is always SCSI_ID_NAA, so we need to hardcode it to avoid false values here. Signed-off-by: Hannes Reinecke <hare@suse.com>
2018-06-14Drop more license boilerplateZbigniew Jędrzejewski-Szmek3-36/+0
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \ xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms' For some reason they were missed previously. All those files seem to have proper SDPX tags.
2018-06-14tree-wide: use proper unicode © instead of (C) where we canLennart Poettering3-4/+4
Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
2018-06-08scsi_id: use _cleanup_free_ on buffer allocated by get_file_optionsFilipe Brandenburger1-3/+2
This simplifies the code a bit and hopefully fixes Coverity finding CID 1382966. There was not actually a resource leak here (Coverity seemed to be confused by thinking log_oom() could actually return 0), but the fix doesn't hurt and should make this code more resilient to future refactorings. Tested: builds fine, manually called scsi_id, seems to work ok.
2018-04-25tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering1-3/+2
This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
2018-04-19tree-wide: drop spurious newlines (#8764)Lennart Poettering1-1/+0
Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
2018-03-16udev: use startswith() instead of the combination of strneq() and strlen() ↵Yu Watanabe1-3/+2
(#8459)
2017-12-25tree-wide: use EXIT_SUCCESS/EXIT_FAILURE in exit() where we canLennart Poettering1-3/+3
2017-11-20tree-wide: adjust fall through comments so that gcc is happyShawn Landden1-1/+1
Distcc removes comments, making the comment silencing not work. I know there was a decision against a macro in commit ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2
2017-11-19Add SPDX license identifiers to source files under the GPLZbigniew Jędrzejewski-Szmek4-0/+4
2017-10-04tree-wide: use IN_SET macro (#6977)Yu Watanabe1-8/+5
2017-10-02tree-wide: use IN_SET where possibleAndreas Rammhold1-1/+1
In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
2017-08-02scsi_id: add missing options to getopt_long() (#6501)Jan Synacek1-1/+1
2017-07-18build-sys: drop gitignore patterns for in-tree buildsZbigniew Jędrzejewski-Szmek1-1/+0
... and other autotools-generated files.
2017-07-18build-sys: drop automake supportZbigniew Jędrzejewski-Szmek1-1/+0
v2: - also mention m4
2017-05-07Rip out setting of the log level from udev_new and put it in a new functionZbigniew Jędrzejewski-Szmek1-0/+2
This function is internal to systemd code, so external users of libudev will not see those log messages. I think this is better. If we want to allow that, the function could be put in libudev and exported. v2: check that the string is more than one char before stripping quotes
2017-04-04tree-wide: standardize on $(PACKAGE_VERSION) for the version stringZbigniew Jędrzejewski-Szmek1-1/+1
We defined both $(VERSION) and $(PACKAGE_VERSION) with the same contents. $(PACKAGE_VERSION) is slightly more descriptive, so settle on that, and drop the other define.
2016-02-20tree-wide: place #pragma once at the same place everywhereLennart Poettering2-4/+4
Usually, we place the #pragma once before the copyright blurb in header files, but in a few cases we didn't. Move those around, so that we do the same thing everywhere.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack4-8/+0
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2015-12-07udev/scsi_id: fix some strange indentationZbigniew Jędrzejewski-Szmek2-69/+68
2015-12-07udev: add emacs header lineZbigniew Jędrzejewski-Szmek4-0/+8
Otherwise emacs wants to use 2-space indentation and other attrocities.
2015-11-17tree-wide: group include of libudev.h with sd-*Thomas Hindoe Paaboel Andersen2-2/+4
2015-11-16tree-wide: sort includesThomas Hindoe Paaboel Andersen2-4/+2
Sort the includes accoding to the new coding style.
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering1-0/+1
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2-19/+23
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-09tree-wide: replace while(1) by for(;;) everywhereLennart Poettering1-1/+1
Another Coccinelle script.
2015-09-09tree-wide: update empty-if coccinelle script to cover empty-while and moreLennart Poettering2-12/+7
Let's also clean up single-line while and for blocks.
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering1-2/+1
Patch via coccinelle.
2015-04-11shared: add random-util.[ch]Ronny Chevalier1-0/+1
2015-01-23#pragma once here and thereZbigniew Jędrzejewski-Szmek2-0/+4
2015-01-05udevadm,..: make --help output of udev tools more like the output of the ↵Lennart Poettering1-13/+15
various other tools
2015-01-01udev: improve help/usage for some more programsRobert Milasan1-1/+1