diff options
author | David Disseldorp <ddiss@samba.org> | 2015-03-13 01:00:51 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-03-18 18:57:21 +0100 |
commit | d1e664f154553e4e2a7a64ff18fcbe979359ab73 (patch) | |
tree | afbd3f6b440c56cc29c03340d458d40cdf263731 | |
parent | 664dca2b44c96a6ef1fd5fb920adbf274a3a6c01 (diff) | |
download | samba-d1e664f154553e4e2a7a64ff18fcbe979359ab73.tar.gz |
s4/ntvfs: support FS_SECTOR_SIZE_INFORMATION query-info
Return the same values as used by s3fs.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source4/libcli/raw/rawfsinfo.c | 21 | ||||
-rw-r--r-- | source4/ntvfs/ntvfs_generic.c | 16 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_fsinfo.c | 15 | ||||
-rw-r--r-- | source4/smb_server/blob.c | 20 |
4 files changed, 72 insertions, 0 deletions
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c index 9c03e144663..bf149ee252e 100644 --- a/source4/libcli/raw/rawfsinfo.c +++ b/source4/libcli/raw/rawfsinfo.c @@ -226,6 +226,23 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, fsinfo->objectid_information.out.unknown[i] = BVAL(blob.data, 16 + i*8); } break; + + case RAW_QFS_SECTOR_SIZE_INFORMATION: + QFS_CHECK_SIZE(28); + fsinfo->sector_size_info.out.logical_bytes_per_sector + = IVAL(blob.data, 0); + fsinfo->sector_size_info.out.phys_bytes_per_sector_atomic + = IVAL(blob.data, 4); + fsinfo->sector_size_info.out.phys_bytes_per_sector_perf + = IVAL(blob.data, 8); + fsinfo->sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic + = IVAL(blob.data, 12); + fsinfo->sector_size_info.out.flags = IVAL(blob.data, 16); + fsinfo->sector_size_info.out.byte_off_sector_align + = IVAL(blob.data, 20); + fsinfo->sector_size_info.out.byte_off_partition_align + = IVAL(blob.data, 24); + break; } default: @@ -319,6 +336,10 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, case RAW_QFS_OBJECTID_INFORMATION: return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, RAW_QFS_OBJECTID_INFORMATION, fsinfo); + + case RAW_QFS_SECTOR_SIZE_INFORMATION: + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_SECTOR_SIZE_INFORMATION, fsinfo); } failed: diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index d3f79196890..4edc31c22cc 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -664,6 +664,22 @@ static NTSTATUS ntvfs_map_fsinfo_finish(struct ntvfs_module_context *ntvfs, ZERO_STRUCT(fs->objectid_information.out.unknown); return NT_STATUS_OK; + case RAW_QFS_SECTOR_SIZE_INFORMATION: + fs->sector_size_info.out.logical_bytes_per_sector + = fs2->generic.out.block_size; + fs->sector_size_info.out.phys_bytes_per_sector_atomic + = fs2->generic.out.block_size; + fs->sector_size_info.out.phys_bytes_per_sector_perf + = fs2->generic.out.block_size; + fs->sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic + = fs2->generic.out.block_size; + fs->sector_size_info.out.flags + = QFS_SSINFO_FLAGS_ALIGNED_DEVICE + | QFS_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE; + fs->sector_size_info.out.byte_off_sector_align = 0; + fs->sector_size_info.out.byte_off_partition_align = 0; + return NT_STATUS_OK; + case RAW_QFS_GENERIC: case RAW_QFS_UNIX_INFO: return NT_STATUS_INVALID_LEVEL; diff --git a/source4/ntvfs/posix/pvfs_fsinfo.c b/source4/ntvfs/posix/pvfs_fsinfo.c index 210433baef5..35256fe69d1 100644 --- a/source4/ntvfs/posix/pvfs_fsinfo.c +++ b/source4/ntvfs/posix/pvfs_fsinfo.c @@ -201,6 +201,21 @@ NTSTATUS pvfs_fsinfo(struct ntvfs_module_context *ntvfs, fs->objectid_information.out.guid = *pvfs->base_fs_uuid; return NT_STATUS_OK; + case RAW_QFS_SECTOR_SIZE_INFORMATION: + fs->sector_size_info.out.logical_bytes_per_sector = block_size; + fs->sector_size_info.out.phys_bytes_per_sector_atomic + = block_size; + fs->sector_size_info.out.phys_bytes_per_sector_perf + = block_size; + fs->sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic + = block_size; + fs->sector_size_info.out.flags + = QFS_SSINFO_FLAGS_ALIGNED_DEVICE + | QFS_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE; + fs->sector_size_info.out.byte_off_sector_align = 0; + fs->sector_size_info.out.byte_off_partition_align = 0; + return NT_STATUS_OK; + default: break; } diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c index a3e11239b1a..24893299a90 100644 --- a/source4/smb_server/blob.c +++ b/source4/smb_server/blob.c @@ -292,6 +292,26 @@ NTSTATUS smbsrv_push_passthru_fsinfo(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } + + case RAW_QFS_SECTOR_SIZE_INFORMATION: + BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 28)); + SIVAL(blob->data, 0, + fsinfo->sector_size_info.out.logical_bytes_per_sector); + SIVAL(blob->data, 4, + fsinfo->sector_size_info.out.phys_bytes_per_sector_atomic); + SIVAL(blob->data, 8, + fsinfo->sector_size_info.out.phys_bytes_per_sector_perf); + SIVAL(blob->data, 12, + fsinfo->sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic); + SIVAL(blob->data, 16, + fsinfo->sector_size_info.out.flags); + SIVAL(blob->data, 20, + fsinfo->sector_size_info.out.byte_off_sector_align); + SIVAL(blob->data, 24, + fsinfo->sector_size_info.out.byte_off_partition_align); + + return NT_STATUS_OK; + default: return NT_STATUS_INVALID_LEVEL; } |