diff options
author | Miles Bader <miles@gnu.org> | 1997-06-20 05:46:44 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-06-20 05:46:44 +0000 |
commit | fafd2efa1c5ce451a9f160756928e8bf64a9cbe2 (patch) | |
tree | a648fb8b3c449887e7e77118feb5d92d41dfbf8f | |
parent | 15b69fdfdc311dcc7f3ebb922ba89096a9e331ed (diff) |
(netfs_S_io_stat):
Set S_IATRANS & S_IROOT bits in st_mode field of returned buffer if
appropriate.
-rw-r--r-- | libnetfs/io-stat.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/libnetfs/io-stat.c b/libnetfs/io-stat.c index 1bc1b17f..5f086318 100644 --- a/libnetfs/io-stat.c +++ b/libnetfs/io-stat.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -23,19 +23,32 @@ #include <string.h> error_t -netfs_S_io_stat (struct protid *fileuser, - io_statbuf_t *statbuf) +netfs_S_io_stat (struct protid *user, io_statbuf_t *statbuf) { error_t err; + struct node *node; - if (!fileuser) + if (! user) return EOPNOTSUPP; - mutex_lock (&fileuser->po->np->lock); - err = netfs_validate_stat (fileuser->po->np, fileuser->user); - if (!err) - bcopy (&fileuser->po->np->nn_stat, statbuf, sizeof (struct stat)); - mutex_unlock (&fileuser->po->np->lock); + node = user->po->np; + mutex_lock (&node->lock); + + err = netfs_validate_stat (node, user->user); + if (! err) + { + bcopy (&node->nn_stat, statbuf, sizeof (struct stat)); + + /* Set S_IATRANS and S_IROOT bits as appropriate. */ + statbuf->st_mode &= ~(S_IATRANS | S_IROOT); + if (fshelp_translated (&node->transbox)) + statbuf->st_mode |= S_IATRANS; /* Has an active translator. */ + if (user->po->shadow_root == node || node == netfs_root_node) + statbuf->st_mode |= S_IROOT; /* Is a root node. */ + } + + mutex_unlock (&node->lock); + return err; } |