Coder Social home page Coder Social logo

seagate / opensea-transport Goto Github PK

View Code? Open in Web Editor NEW
21.0 9.0 22.0 5.37 MB

Cross platform library containing common set of functions to issue standard commands to storage devices.

License: Other

Makefile 0.47% C 99.33% Shell 0.04% Meson 0.16%

opensea-transport's People

Contributors

akhilerm avatar debabratastx avatar harrisonvshen avatar lingaraj-marapli avatar mend-bolt-for-github[bot] avatar nayanataunk avatar petersst avatar pranali-tirkhunde avatar rudock1 avatar rungthida avatar sharma-nidhi avatar shriya-deshmukh avatar sksiaszczak avatar swills avatar swiss3003 avatar szaydel avatar thunderex avatar vibhutipratapsingh avatar vonericsen avatar wangru-stx avatar xahmad avatar xbjfk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensea-transport's Issues

Build failure with missed header "common.h"

Hi,

When I built opensea-transport lib, it reports the error as below on my Ubuntu desktop with GCC:

leoy@leoy-ThinkPad-X240s:~/Work2/Develop/seagate/opensea-transport/Make/gcc$ make
rm -f lib/libopensea-transport.a lib/libopensea-transport.so* *.o ../../src/*.o
rm -rf lib
mkdir -p lib
cc -Wall  -c -fPIC -I. -std=gnu99 -DSEA_NVME_IOCTL_H -D_GNU_SOURCE  -I../../include -I../../include/vendor -I../../../opensea-common/include   ../../src/ata_cmds.c -o ../../src/ata_cmds.o
In file included from ../../src/ata_cmds.c:15:
../../include/common_public.h:17:10: fatal error: common.h: No such file or directory
 #include "common.h"
          ^~~~~~~~~~
compilation terminated.
Makefile:101: recipe for target '../../src/ata_cmds.o' failed
make: *** [../../src/ata_cmds.o] Error 1

I also searched my local repository and cannot find common.h header.

Thanks,
Leo

report /dev/sgx devices sorted in numeric order

I have a number of drives in my system, and when using lsscsi to list them the drives will show up in order of sg1, sg2,.. sg10, sg11, sg12,... But with openSeaChest_something -s, they could only be shown up in alphabetical order like sg1, sg10, sg11,.. sg19, sg2, sg20, sg21,.. sg3, sg4, sg5,...
I could see that the problem is due to alphasort used in scandir:

num_sg_devs = scandir("/dev", &namelist, sg_filter, alphasort);

According to man page, using versionsort could sort it in numeric order.
Could you please consider such an improvement?

redundant ata APIs

Please describe the feature/improvement you would like to see added.

from ata_helper_func.h I could see these definitions:

    //These functions below are commands that can be sent in PIO or DMA Mode.
    //They will automatically try DMA if it is supported, then retry with PIO mode if the Translator or Driver doesn't support issuing DMA mode commands.
    OPENSEA_TRANSPORT_API int send_ATA_Read_Log_Ext_Cmd(tDevice *device, uint8_t logAddress, uint16_t pageNumber, uint8_t *ptrData, uint32_t dataSize, uint16_t featureRegister);
    OPENSEA_TRANSPORT_API int send_ATA_Write_Log_Ext_Cmd(tDevice *device, uint8_t logAddress, uint16_t pageNumber, uint8_t *ptrData, uint32_t dataSize, bool forceRTFRs);
    OPENSEA_TRANSPORT_API int send_ATA_Download_Microcode_Cmd(tDevice *device, eDownloadMicrocodeFeatures subCommand, uint16_t blockCount, uint16_t bufferOffset, uint8_t *pData, uint32_t dataLen, bool firstSegment, bool lastSegment, uint32_t timeoutSeconds);
    OPENSEA_TRANSPORT_API int send_ATA_Trusted_Send_Cmd(tDevice *device, uint8_t securityProtocol, uint16_t securityProtocolSpecific, uint8_t *ptrData, uint32_t dataSize);
    OPENSEA_TRANSPORT_API int send_ATA_Trusted_Receive_Cmd(tDevice *device, uint8_t securityProtocol, uint16_t securityProtocolSpecific, uint8_t *ptrData, uint32_t dataSize);
    OPENSEA_TRANSPORT_API int send_ATA_Read_Buffer_Cmd(tDevice *device, uint8_t *ptrData);
    OPENSEA_TRANSPORT_API int send_ATA_Write_Buffer_Cmd(tDevice *device, uint8_t *ptrData);
    OPENSEA_TRANSPORT_API int send_ATA_Read_Stream_Cmd(tDevice *device, uint8_t streamID, bool notSequential, bool readContinuous, uint8_t commandCCTL, uint64_t LBA, uint8_t *ptrData, uint32_t dataSize);
    OPENSEA_TRANSPORT_API int send_ATA_Write_Stream_Cmd(tDevice *device, uint8_t streamID, bool flush, bool writeContinuous, uint8_t commandCCTL, uint64_t LBA, uint8_t *ptrData, uint32_t dataSize);

    //Similar to above, but for SCT stuff. This will automatically retry from DMA to PIO mode. Also removes GPL flag. Now depends on if device supports GPL or not internally (can be flipped in device->drive_info.ata_Options.generalPurposeLoggingSupported if you want to force a SMART command)
    OPENSEA_TRANSPORT_API int send_ATA_SCT(tDevice *device, eDataTransferDirection direction, uint8_t logAddress, uint8_t *dataBuf, uint32_t dataSize, bool forceRTFRs);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Status(tDevice *device, uint8_t *dataBuf, uint32_t dataSize);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Command(tDevice *device, uint8_t *dataBuf, uint32_t dataSize, bool forceRTFRs);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Data_Transfer(tDevice *device, eDataTransferDirection direction, uint8_t *dataBuf, uint32_t dataSize);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Read_Write_Long(tDevice *device, eSCTRWLMode mode, uint64_t lba, uint8_t *dataBuf, uint32_t dataSize, uint16_t *numberOfECCCRCBytes, uint16_t *numberOfBlocksRequested);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Write_Same(tDevice *device, eSCTWriteSameFunctions functionCode, uint64_t startLBA, uint64_t fillCount, uint8_t *pattern, uint64_t patternLength);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Error_Recovery_Control(tDevice *device, uint16_t functionCode, uint16_t selectionCode, uint16_t *currentValue, uint16_t recoveryTimeLimit);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Feature_Control(tDevice *device, uint16_t functionCode, uint16_t featureCode, uint16_t *state, uint16_t *optionFlags);
    OPENSEA_TRANSPORT_API int send_ATA_SCT_Data_Table(tDevice *device, uint16_t functionCode, uint16_t tableID, uint8_t *dataBuf, uint32_t dataSize);

I could see that these functions has their alternatives, such as ata_SCT in ata_cmds.c is similiar to send_ATA_SCT in ata_helper.c.

Please explain why you think adding this feature/improvement is important.

Is there some reason to provide these redundant functions? Is there any plan to remove some of them?

get_Partition_Count may not be all that useful on Solaris and Derivatives using ZFS

Problem

This function pays attention to the /etc/mnttab file, looking for information about mounted partitions, but quite commonly, on systems where ZFS is the dominant filesystem, which is likely to be majority of Solaris, illumos and derivatives, there won't be anything referring to individual drives or partitions in mnttab, instead there will be ZFS mountpoints. Indeed a given drive may be in a pool and in use, but won't be seen in mnttab.

Expected behavior

I think, if this functionality is to exist on Solaris and friends, it might be necessary to enhance it with checks for ZFS labels. I am not sure about the best approach here, haven't had time to think about. Just wanted to raise this in case it was not already considered.

How to reproduce

NA

Deployment information

Anything with ZFS, which at this point would include Linux, BSD, Solaris, illumos, etc.

Additional information

No response

Print page number & sector count for read / write log verbosity output

Please describe the feature/improvement you would like to see added.

For ata_Read_Log_Ext and ata_Write_Log_Ext, they will print verbosity output such as:

Sending ATA Write Log Ext DMA command - Log 00h

Could we have the page number and sector count also print out together with log page above?

Please explain why you think adding this feature/improvement is important.

This would ease the debugging with logs which has multiple pages.

Array subscript type warning

Problem

I do not know if this is seen elsewhere, have not tested, but I do see it on a recent OmniOS version. This issue should exist anywhere, I would expect. The concern here is that char is signed. It is straight-forward to silence this with casting the curSN and newSN to unsigned char, but that's more lipstick than anything.

[27/116] Compiling C object subprojects/opensea-transport/libopensea-transport.a.p/src_scsi_helper.c.o
../subprojects/opensea-transport/src/scsi_helper.c: In function 'seagate_Serial_Number_Cleanup':
../subprojects/opensea-transport/src/scsi_helper.c:2478:44: warning: array subscript has type 'char' [-Wchar-subscripts]
 2478 |                     if ((*unitSerialNumber)[curSN] != '\0')
      |                                            ^
../subprojects/opensea-transport/src/scsi_helper.c:2480:40: warning: array subscript has type 'char' [-Wchar-subscripts]
 2480 |                         newSerialNumber[newSN] = (*unitSerialNumber)[curSN];
      |                                        ^
../subprojects/opensea-transport/src/scsi_helper.c:2480:69: warning: array subscript has type 'char' [-Wchar-subscripts]
 2480 |                         newSerialNumber[newSN] = (*unitSerialNumber)[curSN];
      |                                                                     ^

Expected behavior

I would not expect this compiler warning to be present.

How to reproduce

Just run the build according to the instructions in BUILDING.md on OmniOS.

Deployment information

SunOS omni-lab 5.11 omnios-r151040-d70a3d4f10 i86pc i386 i86pc
gcc (OmniOS 151040/11.2.0-il-0) 11.2.0

Additional information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.