# HG changeset patch # User asl # Date 1118138824 0 # Node ID 21507ef41413eb840a40d995348f82436cac2445 # Parent 8438b097ea3b4f5880e1799bce6c442b8150cef2 * src/devfs.cxx (dev_stat, dev_fo_fstat): Corrected mode for block devices, made nlink 1. * src/devfs.cxx (dev_fo_fstat): Set st_dev to zero to match dev_stat. diff --git a/packages/io/fileio/current/ChangeLog b/packages/io/fileio/current/ChangeLog --- a/packages/io/fileio/current/ChangeLog +++ b/packages/io/fileio/current/ChangeLog @@ -1,3 +1,9 @@ +2005-05-13 Peter Korsgaard + + * src/devfs.cxx (dev_stat, dev_fo_fstat): Corrected mode for block + devices, made nlink 1. + * src/devfs.cxx (dev_fo_fstat): Set st_dev to zero to match dev_stat. + 2005-05-26 Gary Thomas * tests/socket.c: Fix config test (CYGPKG_POSIX_SIGNALS) diff --git a/packages/io/fileio/current/src/devfs.cxx b/packages/io/fileio/current/src/devfs.cxx --- a/packages/io/fileio/current/src/devfs.cxx +++ b/packages/io/fileio/current/src/devfs.cxx @@ -281,6 +281,7 @@ static int dev_stat ( cyg_mtab_entry { Cyg_ErrNo err; cyg_io_handle_t handle; + cyg_devtab_entry_t *dev; name -= 5; // See comment in dev_open() @@ -290,13 +291,16 @@ static int dev_stat ( cyg_mtab_entry return -err; // Just fill in the stat buffer with some constant values. + dev = (cyg_devtab_entry_t *)handle; - // FIXME: change this when block devices are available - buf->st_mode = __stat_mode_CHR; + if (dev->status & CYG_DEVTAB_STATUS_BLOCK) + buf->st_mode = __stat_mode_BLK; + else + buf->st_mode = __stat_mode_CHR; buf->st_ino = (ino_t)handle; // map dev handle to inode buf->st_dev = 0; // (dev_t)handle; // same with dev id - buf->st_nlink = 0; + buf->st_nlink = 1; buf->st_uid = 0; buf->st_gid = 0; buf->st_size = 0; @@ -444,14 +448,17 @@ static int dev_fo_close (struct CYG_ static int dev_fo_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ) { - // Just fill in the stat buffer with some constant values. + cyg_devtab_entry_t *dev = (cyg_devtab_entry_t *)fp->f_data; - // FIXME: change this when block devices are available - buf->st_mode = __stat_mode_CHR; + // Just fill in the stat buffer with some constant values. + if (dev->status & CYG_DEVTAB_STATUS_BLOCK) + buf->st_mode = __stat_mode_BLK; + else + buf->st_mode = __stat_mode_CHR; buf->st_ino = (ino_t)fp->f_data; // map dev handle to inode - buf->st_dev = (dev_t)fp->f_data; // same with dev id - buf->st_nlink = 0; + buf->st_dev = 0; //(dev_t)fp->f_data; // same with dev id + buf->st_nlink = 1; buf->st_uid = 0; buf->st_gid = 0; buf->st_size = 0;