Ignore:
Timestamp:
May 24, 2009, 7:17:10 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/libsmb/clifsinfo.c

    r206 r221  
    303303        return ret;
    304304}
     305
     306bool cli_get_fs_full_size_info(struct cli_state *cli,
     307                               SMB_BIG_UINT *total_allocation_units,
     308                               SMB_BIG_UINT *caller_allocation_units,
     309                               SMB_BIG_UINT *actual_allocation_units,
     310                               SMB_BIG_UINT *sectors_per_allocation_unit,
     311                               SMB_BIG_UINT *bytes_per_sector)
     312{
     313        bool ret = False;
     314        uint16 setup;
     315        char param[2];
     316        char *rparam=NULL, *rdata=NULL;
     317        unsigned int rparam_count=0, rdata_count=0;
     318
     319        setup = TRANSACT2_QFSINFO;
     320
     321        SSVAL(param,0,SMB_FS_FULL_SIZE_INFORMATION);
     322
     323        if (!cli_send_trans(cli, SMBtrans2,
     324                    NULL,
     325                    0, 0,
     326                    &setup, 1, 0,
     327                    param, 2, 0,
     328                    NULL, 0, 560)) {
     329                goto cleanup;
     330        }
     331
     332        if (!cli_receive_trans(cli, SMBtrans2,
     333                              &rparam, &rparam_count,
     334                              &rdata, &rdata_count)) {
     335                goto cleanup;
     336        }
     337
     338        if (cli_is_error(cli)) {
     339                ret = False;
     340                goto cleanup;
     341        } else {
     342                ret = True;
     343        }
     344
     345        if (rdata_count != 32) {
     346                goto cleanup;
     347        }
     348
     349        if (total_allocation_units) {
     350                *total_allocation_units = BIG_UINT(rdata, 0);
     351        }
     352        if (caller_allocation_units) {
     353                *caller_allocation_units = BIG_UINT(rdata,8);
     354        }
     355        if (actual_allocation_units) {
     356                *actual_allocation_units = BIG_UINT(rdata,16);
     357        }
     358        if (sectors_per_allocation_unit) {
     359                *sectors_per_allocation_unit = IVAL(rdata,24);
     360        }
     361        if (bytes_per_sector) {
     362                *bytes_per_sector = IVAL(rdata,28);
     363        }
     364
     365cleanup:
     366        SAFE_FREE(rparam);
     367        SAFE_FREE(rdata);
     368
     369        return ret;
     370}
     371
     372bool cli_get_posix_fs_info(struct cli_state *cli,
     373                           uint32 *optimal_transfer_size,
     374                           uint32 *block_size,
     375                           SMB_BIG_UINT *total_blocks,
     376                           SMB_BIG_UINT *blocks_available,
     377                           SMB_BIG_UINT *user_blocks_available,
     378                           SMB_BIG_UINT *total_file_nodes,
     379                           SMB_BIG_UINT *free_file_nodes,
     380                           SMB_BIG_UINT *fs_identifier)
     381{
     382        bool ret = False;
     383        uint16 setup;
     384        char param[2];
     385        char *rparam=NULL, *rdata=NULL;
     386        unsigned int rparam_count=0, rdata_count=0;
     387
     388        setup = TRANSACT2_QFSINFO;
     389
     390        SSVAL(param,0,SMB_QUERY_POSIX_FS_INFO);
     391
     392        if (!cli_send_trans(cli, SMBtrans2,
     393                    NULL,
     394                    0, 0,
     395                    &setup, 1, 0,
     396                    param, 2, 0,
     397                    NULL, 0, 560)) {
     398                goto cleanup;
     399        }
     400
     401        if (!cli_receive_trans(cli, SMBtrans2,
     402                              &rparam, &rparam_count,
     403                              &rdata, &rdata_count)) {
     404                goto cleanup;
     405        }
     406
     407        if (cli_is_error(cli)) {
     408                ret = False;
     409                goto cleanup;
     410        } else {
     411                ret = True;
     412        }
     413
     414        if (rdata_count != 56) {
     415                goto cleanup;
     416        }
     417
     418        if (optimal_transfer_size) {
     419                *optimal_transfer_size = IVAL(rdata, 0);
     420        }
     421        if (block_size) {
     422                *block_size = IVAL(rdata,4);
     423        }
     424        if (total_blocks) {
     425                *total_blocks = BIG_UINT(rdata,8);
     426        }
     427        if (blocks_available) {
     428                *blocks_available = BIG_UINT(rdata,16);
     429        }
     430        if (user_blocks_available) {
     431                *user_blocks_available = BIG_UINT(rdata,24);
     432        }
     433        if (total_file_nodes) {
     434                *total_file_nodes = BIG_UINT(rdata,32);
     435        }
     436        if (free_file_nodes) {
     437                *free_file_nodes = BIG_UINT(rdata,40);
     438        }
     439        if (fs_identifier) {
     440                *fs_identifier = BIG_UINT(rdata,48);
     441        }
     442
     443cleanup:
     444        SAFE_FREE(rparam);
     445        SAFE_FREE(rdata);
     446
     447        return ret;
     448}
     449
    305450
    306451/******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.