Changeset be6f505 in rtems


Ignore:
Timestamp:
Nov 21, 2012, 11:20:14 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ad5e070
Parents:
55a36b7
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/12 11:20:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/12 15:38:34)
Message:

ftpfs: Format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/lib/ftpfs.c

    r55a36b7 rbe6f505  
    66
    77/*
    8  * Copyright (c) 2009-2012
    9  * embedded brains GmbH
    10  * Obere Lagerstr. 30
    11  * D-82178 Puchheim
    12  * Germany
    13  * <rtems@embedded-brains.de>
     8 * Copyright (c) 2009-2012 embedded brains GmbH.
     9 *
     10 *  embedded brains GmbH
     11 *  Obere Lagerstr. 30
     12 *  82178 Puchheim
     13 *  Germany
     14 *  <rtems@embedded-brains.de>
    1415 *
    1516 * (c) Copyright 2002
     
    1920 * 82178 Puchheim, Germany
    2021 * <Thomas.Doerfler@imd-systems.de>
    21  *
    22  * Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>.
    2322 *
    2423 * This code has been created after closly inspecting "tftpdriver.c" from Eric
     
    130129  if (rtems_ftpfs_use_timeout(to)) {
    131130    int rv = 0;
    132    
     131
    133132    rv = setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, to, sizeof(*to));
    134133    if (rv != 0) {
     
    164163    return RTEMS_INVALID_NAME;
    165164  }
    166  
     165
    167166  va_start(ap, req);
    168167  rv = ioctl(fd, req, va_arg(ap, void *));
     
    176175    sc = RTEMS_IO_ERROR;
    177176  }
    178  
     177
    179178  return sc;
    180179}
     
    819818typedef struct {
    820819  rtems_ftpfs_pasv_state state;
     820  size_t index;
    821821  uint8_t data [6];
    822   size_t index;
    823822} rtems_ftpfs_pasv_entry;
    824823
     
    829828)
    830829{
    831   rtems_ftpfs_pasv_entry *e = arg;
     830  rtems_ftpfs_pasv_entry *pe = arg;
    832831  size_t i = 0;
    833832
     
    835834    int c = buf [i];
    836835
    837     switch (e->state) {
     836    switch (pe->state) {
    838837      case RTEMS_FTPFS_PASV_START:
    839838        if (!isdigit(c)) {
    840           e->state = RTEMS_FTPFS_PASV_JUNK;
    841           e->index = 0;
     839          pe->state = RTEMS_FTPFS_PASV_JUNK;
     840          pe->index = 0;
    842841        }
    843842        break;
    844843      case RTEMS_FTPFS_PASV_JUNK:
    845844        if (isdigit(c)) {
    846           e->state = RTEMS_FTPFS_PASV_DATA;
    847           e->data [e->index] = (uint8_t) (c - '0');
     845          pe->state = RTEMS_FTPFS_PASV_DATA;
     846          pe->data [pe->index] = (uint8_t) (c - '0');
    848847        }
    849848        break;
    850849      case RTEMS_FTPFS_PASV_DATA:
    851850        if (isdigit(c)) {
    852           e->data [e->index] = (uint8_t) (e->data [e->index] * 10 + c - '0');
     851          pe->data [pe->index] =
     852            (uint8_t) (pe->data [pe->index] * 10 + c - '0');
    853853        } else if (c == ',') {
    854           ++e->index;
    855           if (e->index < sizeof(e->data)) {
    856             e->data [e->index] = 0;
     854          ++pe->index;
     855          if (pe->index < sizeof(pe->data)) {
     856            pe->data [pe->index] = 0;
    857857          } else {
    858             e->state = RTEMS_FTPFS_PASV_DONE;
     858            pe->state = RTEMS_FTPFS_PASV_DONE;
    859859          }
    860860        } else {
    861           e->state = RTEMS_FTPFS_PASV_DONE;
     861          pe->state = RTEMS_FTPFS_PASV_DONE;
    862862        }
    863863        break;
     
    882882  uint32_t data_address = 0;
    883883  uint16_t data_port = 0;
    884 
    885   rtems_ftpfs_pasv_entry pe = {
    886     .state = RTEMS_FTPFS_PASV_START
    887   };
     884  rtems_ftpfs_pasv_entry pe;
     885
     886  memset(&pe, 0, sizeof(pe));
    888887
    889888  /* Send PASV command */
     
    899898    return ENOTSUP;
    900899  }
    901   data_address = ((uint32_t)(pe.data [0]) << 24) + ((uint32_t)(pe.data [1]) << 16)
    902     + ((uint32_t)(pe.data [2]) << 8) + ((uint32_t)(pe.data [3]));
     900  data_address = ((uint32_t)(pe.data [0]) << 24)
     901    + ((uint32_t)(pe.data [1]) << 16)
     902    + ((uint32_t)(pe.data [2]) << 8)
     903    + ((uint32_t)(pe.data [3]));
    903904  data_port = (uint16_t) ((pe.data [4] << 8) + pe.data [5]);
    904905  rtems_ftpfs_create_address(&sa, htonl(data_address), htons(data_port));
Note: See TracChangeset for help on using the changeset viewer.