aboutsummaryrefslogtreecommitdiff
path: root/lib/libcam
Commit message (Collapse)AuthorAgeFilesLines
* libcam(3): make cam_getccb(3) zero the whole ccb, not just the headerEdward Tomasz Napierala2020-12-292-5/+4
| | | | | | | | | | | | Leaving zeroing to the clients leads to error-prone pointer tricks (zeroing needs to preserve the CCB header), and this code is not performance-critical, so there's really no reason to not do it. Reviewed By: imp, rpokala (manpages) Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27333
* Do a sweep and remove most WARNS=6 settingsKyle Evans2020-10-011-2/+0
| | | | | | | | | | | | | | | Repeating the default WARNS here makes it slightly more difficult to experiment with default WARNS changes, e.g. if we did something absolutely bananas and introduced a WARNS=7 and wanted to try lifting the default to that. Drop most of them; there is one in the blake2 kernel module, but I suspect it should be dropped -- the default WARNS in the rest of the build doesn't currently apply to kernel modules, and I haven't put too much thought into whether it makes sense to make it so. Notes: svn path=/head/; revision=366304
* Clean up cam.3Mateusz Piotrowski2020-07-061-9/+11
| | | | | | | | | | | | | - Add a missing Pp [1] - Remove uses of Tn - Use "Xr open 2" when appropriate PR: 247783 [1] Submitted by: PauAmma <pauamma@gundo.com> [1] MFC after: 3 days Notes: svn path=/head/; revision=362956
* Remove unused cam ccb flagsWarner Losh2020-03-101-18/+1
| | | | | | | | | | | | | | These flags have been unused for some time. Some of them were in the CAM2 specification, but CAM has moved on a bit from that. Some were used in the old Pluto VideoSpace (and AirSpace) systems which had the video playback I/O scheduler in userspace, but have been unused since then. Reviewed by: chuck, ken Differential Revision: https://reviews.freebsd.org/D24008 Notes: svn path=/head/; revision=358863
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* pkgbase: Put a lot of binaries and lib in FreeBSD-runtimeEmmanuel Vadot2019-09-051-1/+2
| | | | | | | | | | | | All of them are needed to be able to boot to single user and be able to repair a existing FreeBSD installation so put them directly into FreeBSD-runtime. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21503 Notes: svn path=/head/; revision=351855
* Update the spelling of my name (continuation of r346571)Enji Cooper2019-04-221-2/+1
| | | | | | | | | | | | Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji instead for clarity. While here, remove "All Rights Reserved" from copyrights I "own". MFC after: 1 week Notes: svn path=/head/; revision=346572
* Make cam_error_print() decode NVMe commands.Alexander Motin2019-04-021-1/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=345815
* SPDX: Small for a license ID tags.Pedro F. Giffuni2017-12-271-1/+1
| | | | | | | Use parenthesis for grouping as suggested by the spec. Notes: svn path=/head/; revision=327249
* Fix a null-pointer dereference and a tautological check in cam_get_deviceAlan Somers2017-12-061-2/+7
| | | | | | | | | | | Reported by: Coverity CID: 1017964 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13184 Notes: svn path=/head/; revision=326646
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-1/+3
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* Add a test case for cam_get_device with sa(4) devicesAlan Somers2017-11-221-0/+28
| | | | | | | | | | | | | sa(4) has some unique behavior that is special-cased in cam_get_device. The existing tests don't provide coverage for this special case. Reviewed by: ken MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13185 Notes: svn path=/head/; revision=326101
* Fix multiple bugs in cam_strmatchAlan Somers2017-11-203-0/+114
| | | | | | | | | | | | | | | * Wrongly matches strings that are shorter than the pattern * Fails to match negative character sets * Fails to match character sets that aren't at the end of the pattern * Fails to match character ranges Reviewed by: imp MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13173 Notes: svn path=/head/; revision=326034
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-182-2/+7
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+20
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Add HAS_TESTS to all Makefiles that use the SUBDIR.${MK_TESTS}+= tests idiomEnji Cooper2017-08-021-0/+1
| | | | Notes: svn path=/projects/make-check-sandbox/; revision=321911
* An MMC/SD/SDIO stack using CAMWarner Losh2017-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's flexible queueing will make it easier to write non-storage drivers than the legacy stack. SDIO drivers from both the kernel and as userland daemons are possible, though much of that functionality will come later. Some of the CAM integration isn't complete (there are sleeps in the device probe state machine, for example), but those minor issues can be improved in-tree more easily than out of tree and shouldn't gate progress on other fronts. Appologies to reviews if specific items have been overlooked. Submitted by: Ilya Bakulin Reviewed by: emaste, imp, mav, adrian, ian Differential Review: https://reviews.freebsd.org/D4761 merge with first commit, various compile hacks. Notes: svn path=/head/; revision=320844
* cam: EOL whitespace cleanup and line wrapping changesEd Maste2017-07-041-2/+3
| | | | | | | | | NFC. This cleanup simplifies diffs for review of the MMC-CAM work. Submitted by: kibab Notes: svn path=/head/; revision=320657
* Remove stdlib.h #include added in r319844Enji Cooper2017-06-121-1/+0
| | | | | | | | | | | | A previous iteration of the tests I added in r319844 involved free(3), but that attempt didn't pan out, so I switched to stack allocated buffers instead of heap allocated ones, making the #include unnecessary. MFC after: 1 month MFC with: r319844 Notes: svn path=/head/; revision=319845
* Add positive and negative testcases for cam_get_device(3)Enji Cooper2017-06-121-0/+75
| | | | | | | | MFC after: 1 month Submitted by: Evan Cramer <evan.cramer@isilon.com> Notes: svn path=/head/; revision=319844
* Use __FBSDID instead of the license agreement to embed the $FreeBSD$ RCS keywordEnji Cooper2017-04-061-2/+3
| | | | | | | | | | | Reminded by a comment made by markj w.r.t. using __FBSDID in .c files ala a past Phabricator review. MFC after: 2 months Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316558
* Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)Enji Cooper2017-03-291-27/+27
| | | | | | | | | | | | | | | | | | | | | | Part of my original reasoning as far as converting the snprintf calls was to permit switching over from char[] to wchar_t[] in the future, as well as futureproof in case cam_errbuf's size was ever changed. Unfortunately, my approach was bugged because it conflated the number of items with the size of the buffer, instead of the number of elements being a fixed size != 1 byte. Use nitems(..) instead which counts the quantity of items of a specific type, as opposed to an unqualified sizeof(..) (which assumes that the number of characters is equal to the buffer size). MFC after: 2 months Noted by: cem Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316131
* libcam: use __func__ instead of hardcoding the function name as `func_name`Enji Cooper2017-03-281-36/+30
| | | | | | | | | MFC after: 3 days Tested with: `cam_device_copy(NULL, NULL)` // ;).. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316115
* Use `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf callsEnji Cooper2017-03-281-80/+79
| | | | | | | | | | | Reindent snprintf calls' arguments to match style(9) guidelines with respect to indentation. MFC after: 3 days Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316081
* Fix some localized style(9) issues and reword CAM_ERRBUF_SIZE descriptionEnji Cooper2017-03-281-2/+2
| | | | | | | | | | The CAM_ERRBUF_SIZE description rewording fixes a typo by proxy. MFC after: 3 days Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316080
* libcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointersEnji Cooper2017-03-201-0/+5
| | | | | | | | | | | | This is being done to avoid potential double frees with the values. Differential Revision: D9970 MFC after: 1 week Reviewed by: imp Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315639
* Start adding basic tests for cam(3)Enji Cooper2017-03-153-0/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | This change contains several negative and positive tests for: - cam_open_device - cam_close_device - cam_getccb - cam_freeccb This also contains a test for the failure case noted in bug 217649, i.e., O_RDWR must be specified because pass(4) requires it. This test unfortunately cannot assume that cam-capable devices are present, so the user must explicitly provide a device via `test_suites.FreeBSD.cam_test_device`. In the future, a test kernel module might be shipped, or ctl(4) might be used, as a test device when testing out libcam, which will allow the tests to do away with having to specify an explicit test device. Reviewed by: asomers, ken (earlier diff) MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: D9928 Notes: svn path=/head/; revision=315320
* lib/libcam/cam_cdbparse.3: fix manpage warningsEnji Cooper2017-03-131-13/+16
| | | | | | | | | | | | | | | | | | | - Add comma before and after 'e.g.'; remove surrounding parentheses that were unnecessary after this change [1]. - Add .Mt when referencing ken and Peter Dufault's email addresses [2]. - Sprinkle around .An use where proper [2]. Bump .Dd for the change MFC after: 1 week Reported by: igor [1], manlint [2] Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: D9968 Notes: svn path=/head/; revision=315202
* lib/libcam/cam.3: note that cam_freeccb(3) with ccb == NULL is a no-opEnji Cooper2017-03-131-0/+5
| | | | | | | | | | | | | | | | | This allows me to accurately test this scenario, and for others to rely on the behavior, instead of relying on knowledge obtained via code inspection. Wording borrowed from free(3). MFC after: 1 week Requested by: ken (D9928) Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: D9969 Notes: svn path=/head/; revision=315186
* lib/libcam/cam.3: fix manpage warningsEnji Cooper2017-03-121-4/+4
| | | | | | | | | | | | | | - spelling: "mis-named" should be "misnamed". - delete spaces interspersed in literal representation of `struct cam_device` as hard-tabs separate the types and fields. - Add commas after `e.g.`. Reported by: igor MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315133
* Use .Dv when referencing NULLEnji Cooper2017-03-121-7/+14
| | | | | | | | | | | | This is the correct markup macro, as opposed to .Va (variable names) While here, annotate several bare references to `NULL` with .Dv. MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315132
* Fix up r314189Enji Cooper2017-02-241-1/+1
| | | | | | | | | | | | | The conditional in do_buff_decode(..) after the while loop was accidentally inverted. Only increment the pointer for fmt if it's not NUL. MFC after: 2 weeks X-MFC with: r314189 Reported by: pstef Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314191
* Fix some minor style nits: put parentheses around return valuesEnji Cooper2017-02-241-10/+10
| | | | | | | | MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314190
* Fix up NULL/'\0' uses and fix 2 derefs after NULLEnji Cooper2017-02-241-18/+19
| | | | | | | | | | | MFC after: 2 weeks Reported by: Coverity CID: 1018898, 1018899 Differential Revision: https://reviews.freebsd.org/D6142 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314189
* Use SRCTOP-relative paths to other directories instead of .CURDIR-relative onesEnji Cooper2017-01-201-4/+3
| | | | | | | | | | This implifies pathing in make/displayed output MFC after: 3 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312465
* Make do_buff_decode() not read past the end of the buffer.Alexander Motin2017-01-071-34/+40
| | | | | | | | | Abort format processing as soon as we have no enough data. MFC after: 2 weeks Notes: svn path=/head/; revision=311623
* Fix multiple Coverity Out-of-bounds access false postive issues in CAMDon Lewis2016-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The currently used idiom for clearing the part of a ccb after its header generates one or two Coverity errors for each time it is used. All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON) error because of the treatment of the header as a two element array, with a pointer to the non-existent second element being passed as the starting address to bzero(). Some instances also alsp generate Out-of-bounds access (OVERRUN) errors, probably because the space being cleared is larger than the sizeofstruct ccb_hdr). In addition, this idiom is difficult for humans to understand and it is error prone. The user has to chose the proper struct ccb_* type (which does not appear in the surrounding code) for the sizeof() in the length calculation. I found several instances where the length was incorrect, which could cause either an actual out of bounds write, or incompletely clear the ccb. A better way is to write the code to clear the ccb itself starting at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate the length based on the specific type of struct ccb_* being cleared as specified by the union ccb member being used. The latter can normally be seen in the nearby code. This is friendlier for Coverity and other static analysis tools because they will see that the intent is to clear the trailing part of the ccb. Wrap all of the boilerplate code in a convenient macro that only requires a pointer to the desired union ccb member (or a pointer to the union ccb itself) as an argument. Reported by: Coverity CID: 1007578, 1008684, 1009724, 1009773, 1011304, 1011306 CID: 1011307, 1011308, 1011309, 1011310, 1011311, 1011312 CID: 1011313, 1011314, 1011315, 1011316, 1011317, 1011318 CID: 1011319, 1011320, 1011321, 1011322, 1011324, 1011325 CID: 1011326, 1011327, 1011328, 1011329, 1011330, 1011374 CID: 1011390, 1011391, 1011392, 1011393, 1011394, 1011395 CID: 1011396, 1011397, 1011398, 1011399, 1011400, 1011401 CID: 1011402, 1011403, 1011404, 1011405, 1011406, 1011408 CID: 1011409, 1011410, 1011411, 1011412, 1011413, 1011414 CID: 1017461, 1018387, 1086860, 1086874, 1194257, 1229897 CID: 1229968, 1306229, 1306234, 1331282, 1331283, 1331294 CID: 1331295, 1331535, 1331536, 1331539, 1331540, 1341623 CID: 1341624, 1341637, 1341638, 1355264, 1355324 Reviewed by: scottl, ken, delphij, imp MFH: 1 month Differential Revision: https://reviews.freebsd.org/D6496 Notes: svn path=/head/; revision=300547
* Fix va_list handlingEnji Cooper2016-04-281-38/+41
| | | | | | | | | | | | | | | | | | | | - Add missing va_end's after corresponding va_start's to cleanup state - Eliminate questionable bzero'ing of va_list passed in to do_buff_decode(..) and do_encode(..) from buff_{de,en}code_visit(..) and csio_{de,en}code_visit(..). Make va_list a pointer instead and pass NULL into the underlying functions to handler this in a portable way. - Do some minor style(9) clean up in affected functions. Differential Revision: https://reviews.freebsd.org/D6072 MFC after: 3 days Reported by: cppcheck, Coverity CID: 1018500-1018503 Reviewed by: cem Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298753
* MFHGlen Barber2016-04-162-18/+18
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=298092
| * Clean up trailing whitespace in lib/libcam; no functional changeEnji Cooper2016-04-142-18/+18
| | | | | | | | | | | | | | | | MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=297999
* | First pass through library packaging.Glen Barber2016-02-041-0/+1
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.Bryan Drewery2015-11-251-1/+0
| | | | | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291307
* Set dev->fd to -1 when calling cam_close_spec_device with a valid dev->fdEnji Cooper2015-10-171-1/+3
| | | | | | | | | | | | | descriptor to avoid trashing valid file descriptors that access dev->fd at a later point in time PR: 192671 Submitted by: Scott Ferris <scott.ferris@isilon.com> MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289450
* Revert r284417 it is not necessary anymoreBaptiste Daroussin2015-06-151-1/+1
| | | | Notes: svn path=/head/; revision=284421
* Enforce overwritting SHLIBDIRBaptiste Daroussin2015-06-151-1/+1
| | | | | | | | | | | | Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere. This makes /lib being populated again. Reported by: many Notes: svn path=/head/; revision=284417
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-2/+1
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge head from 7/28Simon J. Gerraty2014-08-191-1/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164