Skip to content

Commit

Permalink
s4/client: add FS_SECTOR_SIZE_INFORMATION query support
Browse files Browse the repository at this point in the history
Signed-off-by: David Disseldorp <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
ddiss authored and jrasamba committed Mar 18, 2015
1 parent ba9fd54 commit 664dca2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
17 changes: 17 additions & 0 deletions source4/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,7 @@ fsinfo_level_t fsinfo_levels[] = {
{"quota-information", RAW_QFS_QUOTA_INFORMATION},
{"fullsize-information", RAW_QFS_FULL_SIZE_INFORMATION},
{"objectid", RAW_QFS_OBJECTID_INFORMATION},
{"sector-size-info", RAW_QFS_SECTOR_SIZE_INFORMATION},
{NULL, RAW_QFS_GENERIC}
};

Expand Down Expand Up @@ -1763,6 +1764,22 @@ static int cmd_fsinfo(struct smbclient_context *ctx, const char **args)
(unsigned long long) fsinfo.objectid_information.out.unknown[4],
(unsigned long long) fsinfo.objectid_information.out.unknown[5] );
break;
case RAW_QFS_SECTOR_SIZE_INFORMATION:
d_printf("\tlogical_bytes_per_sector: %u\n",
(unsigned)fsinfo.sector_size_info.out.logical_bytes_per_sector);
d_printf("\tphys_bytes_per_sector_atomic: %u\n",
(unsigned)fsinfo.sector_size_info.out.phys_bytes_per_sector_atomic);
d_printf("\tphys_bytes_per_sector_perf: %u\n",
(unsigned)fsinfo.sector_size_info.out.phys_bytes_per_sector_perf);
d_printf("\tfs_effective_phys_bytes_per_sector_atomic: %u\n",
(unsigned)fsinfo.sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic);
d_printf("\tflags: 0x%x\n",
(unsigned)fsinfo.sector_size_info.out.flags);
d_printf("\tbyte_off_sector_align: %u\n",
(unsigned)fsinfo.sector_size_info.out.byte_off_sector_align);
d_printf("\tbyte_off_partition_align: %u\n",
(unsigned)fsinfo.sector_size_info.out.byte_off_partition_align);
break;
case RAW_QFS_GENERIC:
d_printf("\twrong level returned\n");
break;
Expand Down
20 changes: 19 additions & 1 deletion source4/libcli/raw/interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,9 @@ enum smb_fsinfo_level {
RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION,
RAW_QFS_SECTOR_SIZE_INFORMATION = SMB_QFS_SECTOR_SIZE_INFORMATION,
};


/* union for fsinfo() backend call. Note that there are no in
Expand Down Expand Up @@ -1331,6 +1333,22 @@ union smb_fsinfo {
uint64_t unknown[6];
} out;
} objectid_information;

/* trans2 RAW_QFS_SECTOR_SIZE_INFORMATION interface */
struct {
enum smb_fsinfo_level level;
struct smb2_handle handle; /* only for smb2 */

struct {
uint32_t logical_bytes_per_sector;
uint32_t phys_bytes_per_sector_atomic;
uint32_t phys_bytes_per_sector_perf;
uint32_t fs_effective_phys_bytes_per_sector_atomic;
uint32_t flags;
uint32_t byte_off_sector_align;
uint32_t byte_off_partition_align;
} out;
} sector_size_info;
};


Expand Down
8 changes: 8 additions & 0 deletions source4/libcli/raw/trans2.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Found 4 aliased levels
#define SMB_QFS_QUOTA_INFORMATION 1006
#define SMB_QFS_FULL_SIZE_INFORMATION 1007
#define SMB_QFS_OBJECTID_INFORMATION 1008
#define SMB_QFS_SECTOR_SIZE_INFORMATION 1011


/* trans2 qfileinfo/qpathinfo */
Expand Down Expand Up @@ -283,6 +284,13 @@ Found 0 aliased levels
#define QFS_TYPE_MOUNTED 0x20
#define QFS_TYPE_VIRTUAL 0x40

/* SMB_QFS_SECTOR_SIZE_INFORMATION values */
#define QFS_SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001
#define QFS_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
#define QFS_SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004
#define QFS_SSINFO_FLAGS_TRIM_ENABLED 0x00000008

#define QFS_SSINFO_OFFSET_UNKNOWN 0xffffffff

/*
* Thursby MAC extensions....
Expand Down

0 comments on commit 664dca2

Please sign in to comment.