diff options
author | Roland McGrath <roland@gnu.org> | 1999-12-14 00:59:38 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-12-14 00:59:38 +0000 |
commit | 159a5b113c1d907d2da005900174b6f0b94873b0 (patch) | |
tree | 8e89394bfcafb250a068ee01ad8828b36caf2608 /libdiskfs/file-getfh.c | |
parent | b0ae1be5ee65598b17f117b5f72462c58b563309 (diff) | |
download | hurd-159a5b113c1d907d2da005900174b6f0b94873b0.tar.gz hurd-159a5b113c1d907d2da005900174b6f0b94873b0.tar.bz2 hurd-159a5b113c1d907d2da005900174b6f0b94873b0.zip |
1999-12-13 Roland McGrath <roland@baalperazim.frob.com>
Rewrite of a fix provided by Bill White <bill.white@griggsinst.com>:
* fhandle.h (union diskfs_fhandle): Replaces struct diskfs_fhandle.
Use a union element of char[28] to ensure size requirement.
* fsys-getfile.c (diskfs_S_fsys_getfile): Update uses for new type.
* file-getfh.c (diskfs_S_file_getfh): Likewise.
Diffstat (limited to 'libdiskfs/file-getfh.c')
-rw-r--r-- | libdiskfs/file-getfh.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c index c755e911..a2dbb045 100644 --- a/libdiskfs/file-getfh.c +++ b/libdiskfs/file-getfh.c @@ -9,7 +9,7 @@ the Free Software Foundation; either version 2, or (at your option) any later version. - The GNU Hurd is distributed in the hope that it will be useful, + The GNU Hurd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -29,30 +29,30 @@ error_t diskfs_S_file_getfh (struct protid *cred, char **fh, unsigned *fh_len) { struct node *node; - struct diskfs_fhandle *f; + union diskfs_fhandle *f; if (! cred) return EOPNOTSUPP; if (! idvec_contains (cred->user->uids, 0)) return EPERM; - + + assert (sizeof *f == sizeof f->bytes); + node = cred->po->np; mutex_lock (&node->lock); if (*fh_len < sizeof (struct diskfs_fhandle)) - *fh = mmap (0, sizeof (struct diskfs_fhandle), PROT_READ|PROT_WRITE, + *fh = mmap (0, sizeof (struct diskfs_fhandle), PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - *fh_len = sizeof (struct diskfs_fhandle); - - f = (struct diskfs_fhandle *)*fh; + *fh_len = sizeof *f; - f->cache_id = node->cache_id; - f->gen = node->dn_stat.st_gen; + f = (union diskfs_fhandle *) *fh; - f->filler1 = 0; - bzero (f->filler2, sizeof f->filler2); + bzero (f, sizeof *f); + f->data.cache_id = node->cache_id; + f->data.gen = node->dn_stat.st_gen; mutex_unlock (&node->lock); |