GithubHelp home page GithubHelp logo

westerndigitalcorporation / libzbc Goto Github PK

View Code? Open in Web Editor NEW
150.0 150.0 55.0 2.39 MB

ZBC device manipulation library. When submitting a bug report, PLEASE DO NOT SUBMIT CONFIDENTIAL INFORMATION OR INFORMATION SPECIFIC TO DRIVES THAT ARE VENDOR SAMPLES OR NOT PUBLICLY AVAILABLE.

License: BSD 2-Clause "Simplified" License

Shell 26.55% C 66.96% Makefile 1.93% M4 0.52% Roff 4.03%

libzbc's People

Contributors

alandtse avatar damien-lemoal avatar davidbutterfield avatar dmitry-fomichev avatar floatious avatar harshavardhana avatar hgst avatar jengelh avatar kawasaki avatar mmilburn avatar nmtadam avatar rajatgoel avatar suzu-masa avatar ttlajus avatar twilfredo avatar yhr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libzbc's Issues

Can't build on Ubuntu 12.10

Hi. I'm trying to build on Ubuntu 12.10 (yes, it's back-level) and am running into a problem I don't know how to solve. Would you please help me out?

When I run ./configure, I get the following response:
...
checking for GTK... no
configure: error: Package requirements (gtk+-2.0) were not met:

No package 'gtk+-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTK_CFLAGS
and GTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

So, I cleverly tried installing gtk+-2.0 by issuing "sudo apt-get install gtk+-2.0". This gets me the following response:
...
Note, selecting 'gir1.0-gtk-2.0' for regex 'gtk+-2.0'
gir1.2-gtk-2.0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Can you suggest what I need to do? Thanks,

Steve

v4.0

When I was using v4.0 on an emulated SATA drive, all the tests run. However, zbc_report_zones listed 0 zones. gzbc showed no zones.

Switching to v2.0 and everything seems to work.

Can anybody reproduce this problem?

Reading from a zone

Hi,

I am using libzbc in emulation mode (i.e. with a conventional device).
After writing to a zone via zbc_write_zone, reading from the zone using zbc_read_zone fails.

I think the reason for this is because of zbc_fake.c line 271:

if (zone->zbz_write_pointer + lba_count >
            zone->zbz_start + zone->zbz_length)
                return -EIO;

I believe this snippet is copied over from zbc_file_pwrite.

I think for zbc_file_pread, it should be modified to:

if (start_lba + lba_count >
            zone->zbz_start + zone->zbz_length)
                return -EIO;

Thanks!
Albert

Build without libgtk/GUI?

Is there a way to compile without libgtk? I am hitting this issue referenced earlier: #2 but I don't want to build the GUI program and it seems it should be optional based on how the autoconf file is authored.

Issue running configure on Ubuntu 16

checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking scsi/scsi.h usability... no
checking scsi/scsi.h presence... yes
configure: WARNING: scsi/scsi.h: present but cannot be compiled
configure: WARNING: scsi/scsi.h:     check for missing prerequisite headers?
configure: WARNING: scsi/scsi.h: see the Autoconf documentation
configure: WARNING: scsi/scsi.h:     section "Present But Cannot Be Compiled"
configure: WARNING: scsi/scsi.h: proceeding with the compiler's result
configure: WARNING:     ## dddddddddddddddddddddddddddddddddddd ##
configure: WARNING:     ## Report this to [email protected] ##
configure: WARNING:     ## dddddddddddddddddddddddddddddddddddd ##
checking for scsi/scsi.h... no
configure: error: Couldn't find scsi/scsi.h

-rw-r--r-- 1 root root 6969 Feb 5 2019 /usr/include/scsi/scsi.h

Any help/tips appreciated!

testsuit fail for Seagate 8TB HDD with ATA Interface

Hi, I am trying to use libzbc library to test the Seagate Host Aware 8TB HDD Drive.

$ sudo zbc_info /dev/sg1
Device /dev/sg1: ATA ST8000AS0022-1WL SN01
ATA ZAC interface, Host-aware disk model
15628053168 logical blocks of 512 B
1953506646 physical blocks of 4096 B
8001.563 GB capacity

All tests pass except the two Sense Key Tests for reporting zones as shown below:

Executing sense key, sense code tests...
    010: REPORT_ZONES logical block out of range...                                                                     [Failed]
        => Expected Illegal-request / Logical-block-address-out-of-range
           Got  / 
    011: REPORT_ZONES invalid reporting option...                                                                       [Failed]
        => Expected Illegal-request / Invalid-field-in-cdb
           Got Illegal-request / Unaligned-write-command

Running the tests individually gives us the following output:

Test 010


sudo ./zbc_test_report_zones -v -lba 15628053168 /dev/sg1
(libzbc) /dev/sg1: ########## Trying BLOCK driver ##########
(libzbc) /dev/sg1: ########## BLOCK driver failed -6 ##########
(libzbc) /dev/sg1: ########## Trying ATA driver ##########
(libzbc) /dev/sg1: Sending command 0x00:0x00 (TEST UNIT READY):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 |      |      |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command TEST UNIT READY done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command TEST UNIT READY executed in 0 ms, 0 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x07 | 0x20 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0x90 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x02 (0x01), host status 0x0000, driver status 0x0008 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 0 B transfered
(libzbc) Device signature is 00:00
(libzbc) Standard ATA signature detected
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x04 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x40 | 0x4a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 28 ms, 524288 B transfered
(libzbc) Host aware ATA device detected
(libzbc) /dev/sg1: Sending command 0x12:0x00 (INQUIRY):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x12 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |   4 | 0x60 | 0x00 |      |      |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command INQUIRY done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command INQUIRY executed in 0 ms, 96 B transfered
(libzbc) /dev/sg1: Sending command 0x9e:0x10 (READ CAPACITY 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x9e | 0x10 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x20 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command READ CAPACITY 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command READ CAPACITY 16 executed in 0 ms, 32 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x01 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x30 | 0x00 | 0x09 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0x47 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 512 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x06 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0xc3 | 0x00 | 0x01 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0xef | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 0 B transfered
(libzbc) /dev/sg1: Using SCSI R/W commands
(libzbc) /dev/sg1: ########## ATA driver succeeded ##########
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x04 | 0x00 | 0xa3 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0xb0 | 0x03 | 0x2a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x81 | 0x40 | 0x4a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 8 ms, 524288 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x80 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x08 | 0xa3 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0xb0 | 0x03 | 0x2a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x81 | 0x40 | 0x4a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 4096 B transfered
[ZONE_INFO],00000,0x3,0x1,15627976704,76464,15627976704

Test 011:

(libzbc) /dev/sg1: ########## Trying BLOCK driver ##########
(libzbc) /dev/sg1: ########## BLOCK driver failed -6 ##########
(libzbc) /dev/sg1: ########## Trying ATA driver ##########
(libzbc) /dev/sg1: Sending command 0x00:0x00 (TEST UNIT READY):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 |      |      |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command TEST UNIT READY done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command TEST UNIT READY executed in 4 ms, 0 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x07 | 0x20 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0x90 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x02 (0x01), host status 0x0000, driver status 0x0008 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 0 B transfered
(libzbc) Device signature is 00:00
(libzbc) Standard ATA signature detected
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x04 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x40 | 0x4a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 28 ms, 524288 B transfered
(libzbc) Host aware ATA device detected
(libzbc) /dev/sg1: Sending command 0x12:0x00 (INQUIRY):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x12 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |   4 | 0x60 | 0x00 |      |      |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command INQUIRY done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command INQUIRY executed in 0 ms, 96 B transfered
(libzbc) /dev/sg1: Sending command 0x9e:0x10 (READ CAPACITY 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x9e | 0x10 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x20 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command READ CAPACITY 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command READ CAPACITY 16 executed in 0 ms, 32 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x01 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x30 | 0x00 | 0x09 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0x47 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 216 ms, 512 B transfered
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x06 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0xc3 | 0x00 | 0x01 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x00 | 0xef | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x00 (0x00), host status 0x0000, driver status 0x0000 (flags 0x0000)
(libzbc) /dev/sg1: Command ATA 16 executed in 0 ms, 0 B transfered
(libzbc) /dev/sg1: Using SCSI R/W commands
(libzbc) /dev/sg1: ########## ATA driver succeeded ##########
(libzbc) /dev/sg1: Sending command 0x85:0x00 (ATA 16):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x85 | 0x0d | 0x0e | 0x0a |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x04 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  12 | 0x00 | 0x40 | 0x4a | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: Command ATA 16 done: status 0x02 (0x01), host status 0x0000, driver status 0x0008 (flags 0x0000)
(libzbc) [ERROR] /dev/sg1: Command ATA 16 failed with status 0x02 (0x01), host status 0x0000, driver status 0x0008 (flags 0x0000)
(libzbc) /dev/sg1: Sense data (22 B):
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |Byte |   0  |  1   |  2   |  3   |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   0 | 0x72 | 0x05 | 0x21 | 0x04 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   4 | 0x00 | 0x00 | 0x00 | 0x0e |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |   8 | 0x09 | 0x0c | 0x01 | 0x04 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |  12 | 0x04 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * |=====+======+======+======+======+
(libzbc) /dev/sg1: * |  16 | 0x00 | 0x00 | 0x00 | 0x00 |
(libzbc) /dev/sg1: * +==================================
(libzbc) /dev/sg1: * |  20 | 0x40 | 0x51 |      |      |
(libzbc) /dev/sg1: * +==================================
[TEST][ERROR],zbc_report_nr_zones at lba 0, ro 0x0a failed -5
[TEST][ERROR][SENSE_KEY],Illegal-request
[TEST][ERROR][ASC_ASCQ],Unaligned-write-command

Should these two tests pass for the ATA disks as well?

Thanks,
Shehbaz

Support for vector I/O preadv & pwritev

I was going to add support for vector I/O with new zbc_preadv and zbc_pwritev interfaces with your approval.

One question I have before getting started is if vector I/O is supported by Direct I/O when using the sg driver.

In here: https://www.tldp.org/HOWTO/pdf/SCSI-Generic-HOWTO.pdf
I see

Furthermore iovec_count's variety of scatter gather (into the user space) is only available when normal (or "indirect") IO is being used. Hence when the SG_FLAG_DIRECT_IO or SG_FLAG_MMAP_IO are set in 'flags' then 'iovec_count' should be zero.

However, inspecting the 4.20 kernel, I don't see any limitation so perhaps this statement is obsolete. Are you aware?

As an experiment I added a single sg_iovec_t iovec[1]; to zbc_sg_cmd and funneled all I/O through this single vector in zbc_sg_cmd_init. I think this is a decent hack

	if (cmd->out_bufsz) {
		cmd->io_hdr.dxferp = cmd->iovec;
		cmd->io_hdr.iovec_count = 1;
		cmd->iovec[0].iov_base = cmd->out_buf;
		cmd->iovec[0].iov_len = cmd->out_bufsz;
	}

I'm not seeing any errors with reads or writes. Do you think this is enough to prove this out?

Error Reporting with Multi-Threaded I/O

Currently the zbc_errno struct is defined per device and is cleared / reset per I/O. When using async I/O to the same device, one runs the risk of losing critical sense key / sense code information.

I'm wondering if we can make zbc_errno thread local.

Alternatively, we could open multiple zbd device handles per I/O thread.

Max Segments assuming device path

In using a custom symbolic link for the device path, the zbc_sg_max_segments code will fail to read the max segments as it is assuming the absolute device path.

Add code to check if the zbd_filename is a link and decode the link. Something like:

/**
 * Gets the absolute device path from the input device
 */
static void zbc_sg_device_path(struct zbc_device *dev, char *path, int path_len)
{
	struct stat lst;
	ssize_t len;


    strncpy(path, dev->zbd_filename, path_len);

    if (lstat(dev->zbd_filename, &lst) == 0) {
        if (S_ISLNK(lst.st_mode)) {
            len = readlink(dev->zbd_filename, path, path_len-1);
            if (len < 0) {
                zbc_error("%s: readlink failed %d (%s)\n",
                           dev->zbd_filename,
                           errno, strerror(errno));
            } else {
                path[len] = '\0';
            }
        }
    }
}

License Question (BSD and/or LGPL)

This is more of a question than a problem/issue..

Background:
I am interested in writing Rust bindings for libzbc. I see the header and library source files of libzbc have both BSD-2-Clause and LGPL-3.0-or-later licenses present. If/when I finish this poject, I'd like to release it under the same licenses as libzbc.

Question:
Are consumers of libzbc free to choose from either license, or will they need to comply with both?
Said another way: Will anybody linking statically to libzbc also need to release their application's source code in order to comply with LGPL obligations (since there is no static linking exception)?

I can organize the Rust project to link against libzbc either way (statically, or dynamically). I'll probably add a feature flag so linking either way remains possible. I'm just trying to decide which method of linking should be the default.

Thanks in advance for any guidance / much appreciated

cannot build v4.3.1

I can build v4.3.0 but v4.3.1 fails with

lib/zbc_block.c:29:28: fatal error: linux/blkzoned.h: No such file or directory

The build machine is on kernel 4.4.0-42-generic and I've got the kernel headers installed.

configure: error: Couldn't find scsi/sg.h

I'm trying to build libzbc v5.8.5 on an Oracle Linux VM - 4.14.35-1902.3.2.el7uek.x86_64. The configure step fails with this error:

./configure --with-test CFLAGS=-fPIC
.
.
.
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for scsi/scsi.h... yes
checking for scsi/sg.h... no
configure: error: Couldn't find scsi/sg.h

I've had no luck building this on physical machine with the same OS installed as well. I get the same error. Any ideas, what's going on?

zlib set zones persistent across boots.

I suggest that, instead of putting the set zones emulation metadata into /tmp, that it be placed in /etc/zbc/.meta. This would allow persistence across boots.

Thanks

Writing a Complete Zone on the Actual Drive

Hi,

I am trying to write an entire zone (256 MB) on an actual drive (not a fake one) and I am getting a "Cannot Allocate Memory (-12)" error. I am using the "zbc_write_zone" program.

The same does not happen if I write only 4 MB, and the interesting thing is that the program ends up writing 4 MB, 64 times. Hence, the total amount written is 256 MB. Yet, it gives an error if I write all 256 MB at once. Is this a bug or is this expected behavior?

Also, I get the same error "Cannot Allocate Memory (-12)" if I ever write more than 4 MB. Please find attached, the output from my terminal.

Note: This does not happen on a fake drive with emulation. I am able to write an entire zone without issue.

Thanks,

Yash
SMRDriveTest.txt

Errors of runing zbc_test.sh in libzbc-master

Hi,
I am trying compile-and-install libzbc-master following README,but when runing zbc_test.sh in libzbc-master there are errors :Test program zbc_test_close_zone not found in directory /home/zhaoyajun/Documents/libzbc-master/test/programs .
Whether or not /test/programs/close_zone/Makemodule.am do not run ,I need your help.
Thanks .
David

about logs of sg* or ad*

I ran the commands in the order posted. Most of tests hadn't succeed, such as zbc_set_zones.
I have attached a terminal log script. Please have a look
test.txt

Thanks
Sincerely

David

Make it possible to choose backends we want to try

I think there should be an easy way to choose the device types we want to try in zbc_open. If you guys are ok with adding another parameter to zbc_open (say a bitmask enabling/disabling) device types, I can work on a diff for that.

Release 5.8.1 FTBFS

[   28s] + cd libzbc-5.8.1
[   28s] + autoreconf -fi
[   31s] libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
[   31s] libtoolize: copying file 'build-aux/ltmain.sh'
[   31s] libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
[   31s] libtoolize: copying file 'm4/libtool.m4'
[   31s] libtoolize: copying file 'm4/ltoptions.m4'
[   31s] libtoolize: copying file 'm4/ltsugar.m4'
[   31s] libtoolize: copying file 'm4/ltversion.m4'
[   31s] libtoolize: copying file 'm4/lt~obsolete.m4'
[   34s] configure.ac:19: installing 'build-aux/ar-lib'
[   34s] configure.ac:12: installing 'build-aux/compile'
[   34s] configure.ac:21: installing 'build-aux/config.guess'
[   34s] configure.ac:21: installing 'build-aux/config.sub'
[   34s] configure.ac:9: installing 'build-aux/install-sh'
[   34s] configure.ac:9: installing 'build-aux/missing'
[   34s] automake: error: cannot open < tools/gzbc/Makemodule.am: No such file or directory
[   34s] autoreconf: automake failed with exit status: 1

Fake ZBC Driver Metadata is not persisted across power cycle

I'm doing host restart testing where we power down the host after I/O is written and then verify the host data on power on. Nothing should be in-flight when the power down occurs.

Prior power loss I see sectors being written
(libzbc) /data/fake/fakesmr3: Write 784 sectors at sector 218352

However after a power cycle the zone is empty, resulting in I/O errors
(libzbc) /data/fake/fakesmr3: Read 784 sectors at sector 218352 (libzbc) [ERROR] /data/fake/fakesmr3: Read 784 sectors at sector 218352 failed 5 (Input/output error)

Using zbc_report_zones I can easily see there are zones we have written to but remain empty following power-cycle, including our zone with the target read
Zone 00100: type 0x2 (Sequential-write-required), cond 0xe (Full), reset recommended 0, non_seq 0, sector 204800, 2048 sectors, wp 206848 Zone 00101: type 0x2 (Sequential-write-required), cond 0xe (Full), reset recommended 0, non_seq 0, sector 206848, 2048 sectors, wp 208896 Zone 00102: type 0x2 (Sequential-write-required), cond 0xe (Full), reset recommended 0, non_seq 0, sector 208896, 2048 sectors, wp 210944 Zone 00103: type 0x2 (Sequential-write-required), cond 0xe (Full), reset recommended 0, non_seq 0, sector 210944, 2048 sectors, wp 212992 Zone 00104: type 0x2 (Sequential-write-required), cond 0xe (Full), reset recommended 0, non_seq 0, sector 212992, 2048 sectors, wp 215040 Zone 00105: type 0x2 (Sequential-write-required), cond 0x1 (Empty), reset recommended 0, non_seq 0, sector 215040, 2048 sectors, wp 215040 Zone 00106: type 0x2 (Sequential-write-required), cond 0x1 (Empty), reset recommended 0, non_seq 0, sector 217088, 2048 sectors, wp 217088 Zone 00107: type 0x2 (Sequential-write-required), cond 0x1 (Empty), reset recommended 0, non_seq 0, sector 219136, 2048 sectors, wp 219136 Zone 00108: type 0x2 (Sequential-write-required), cond 0x1 (Empty), reset recommended 0, non_seq 0, sector 221184, 2048 sectors, wp 221184
The question I have is does the fake driver support power-loss testing? It's almost like the metadata isn't synchronized with the process and data is loss. Does this seem like a sound understanding of the problem?

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.