[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FTP file system and cp shell command

Sebastian Huber wrote:
> Hi,
> I started to rewrite the FTP file system (FTP client).  One goal is to support
> the standard cp shell command.  So I have to provide some sort of information
> for stat().  My current approach looks like:
> static int rtems_ftpfs_fstat(
>   rtems_filesystem_location_info_t *loc,
>   struct stat *st
> )
> {
>   memset( st, 0, sizeof( *st));
>   st->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO;
>   return 0;
> }
> This works fine for "cp local remote" and "cp remote local" variants.  The case
> "cp remote remote" fails because the node index (st->ino) and device (st->dev)
> is equal to zero for both remote files.  So cp assumes that the files are
> identical and there is nothing to copy.  Does anyone know a good way to provide
> a fake node index?
Have a global/static "node counter" and increment it on
every open?
> Have a nice day!