From e1a049e27ae81f2eac0d59fbdd221710ec2d8ab5 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sat, 10 May 2003 00:12:29 +0000 Subject: 2003-04-26 Marco Gerards * dir.c (diskfs_get_directs): Consider ENTRY when adding "." and ".." for the rootnode. * inode.c (read_node): Use ifind instead of diskfs_cached_lookup and do not use diskfs_nput anymore. * main.c (diskfs_S_fsys_getfile): New function. --- fatfs/ChangeLog | 9 +++++++++ fatfs/dir.c | 15 ++++++--------- fatfs/inode.c | 18 ++++++------------ fatfs/main.c | 14 +++++++++++++- 4 files changed, 34 insertions(+), 22 deletions(-) (limited to 'fatfs') diff --git a/fatfs/ChangeLog b/fatfs/ChangeLog index 0de81963..180ff9b3 100644 --- a/fatfs/ChangeLog +++ b/fatfs/ChangeLog @@ -1,3 +1,12 @@ +2003-04-26 Marco Gerards + + * dir.c (diskfs_get_directs): Consider ENTRY when adding + "." and ".." for the rootnode. + + * inode.c (read_node): Use ifind instead of diskfs_cached_lookup + and do not use diskfs_nput anymore. + * main.c (diskfs_S_fsys_getfile): New function. + 2002-10-06 Marcus Brinkmann * main.c (diskfs_server_version): Set to HURD_VERSION. diff --git a/fatfs/dir.c b/fatfs/dir.c index 9ef76c49..0b4b4599 100644 --- a/fatfs/dir.c +++ b/fatfs/dir.c @@ -839,7 +839,7 @@ diskfs_get_directs (struct node *dp, filenames). */ if ((char)ep->name[0] == FAT_DIR_NAME_DELETED || (ep->attribute & FAT_DIR_ATTR_LABEL)) - i--; + i--; bufp = bufp + FAT_DIR_REC_LEN; } @@ -857,13 +857,10 @@ diskfs_get_directs (struct node *dp, /* The root directory in FAT file systems doesn't contain entries for DOT and DOTDOT, they are special cased below. */ - if (dp == diskfs_root_node && i < 2) - { - if (i == 0) - ep = ˙ - else - ep = &dotdot; - } + if (dp == diskfs_root_node && (i + entry == 0)) + ep = ˙ + else if (dp == diskfs_root_node && (i + entry == 1)) + ep = &dotdot; else ep = (struct dirrect *) bufp; @@ -931,7 +928,7 @@ diskfs_get_directs (struct node *dp, /* And move along. */ datap = datap + reclen; - if (!(dp == diskfs_root_node && i < 2)) + if (!(dp == diskfs_root_node && i + entry < 2)) bufp = bufp + FAT_DIR_REC_LEN; i++; } diff --git a/fatfs/inode.c b/fatfs/inode.c index 4119551a..50f8662b 100644 --- a/fatfs/inode.c +++ b/fatfs/inode.c @@ -1,5 +1,5 @@ /* inode.c - Inode management routines. - Copyright (C) 1994,95,96,97,98,99, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1994,95,96,97,98,99,2000,02,03 Free Software Foundation, Inc. Modified for fatfs by Marcus Brinkmann This file is part of the GNU Hurd. @@ -273,18 +273,16 @@ read_node (struct node *np, vm_address_t buf) { if (buf == 0) { - err = diskfs_cached_lookup (vk.dir_inode, &dp); - if (err) - return err; + /* FIXME: We know intimately that the parent dir is locked + by libdiskfs. The only case it is not locked is for NFS + (fsys_getfile) and we disabled that. */ + dp = ifind (vk.dir_inode); /* Map in the directory contents. */ memobj = diskfs_get_filemap (dp, prot); if (memobj == MACH_PORT_NULL) - { - diskfs_nput (dp); - return errno; - } + return errno; buflen = round_page (dp->dn_stat.st_size); err = vm_map (mach_task_self (), @@ -347,8 +345,6 @@ read_node (struct node *np, vm_address_t buf) { if (our_buf && buf) munmap ((caddr_t) buf, buflen); - if (dp) - diskfs_nput (dp); return err; } st->st_size = np->allocsize; @@ -384,8 +380,6 @@ read_node (struct node *np, vm_address_t buf) if (our_buf && buf) munmap ((caddr_t) buf, buflen); - if (dp) - diskfs_nput (dp); return 0; } diff --git a/fatfs/main.c b/fatfs/main.c index 800e58b4..b6916a24 100644 --- a/fatfs/main.c +++ b/fatfs/main.c @@ -1,5 +1,5 @@ /* main.c - FAT filesystem. - Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. Written by Thomas Bushnell, n/BSG and Marcus Brinkmann. This file is part of the GNU Hurd. @@ -263,3 +263,15 @@ diskfs_readonly_changed (int readonly) abort (); } +/* FIXME: libdiskfs doesn't lock the parent dir when looking up a node + for fsys_getfile, so we disable NFS. */ +error_t +diskfs_S_fsys_getfile (mach_port_t fsys, + mach_port_t reply, mach_msg_type_name_t reply_type, + uid_t *uids, mach_msg_type_number_t nuids, + gid_t *gids, mach_msg_type_number_t ngids, + char *handle, mach_msg_type_number_t handle_len, + mach_port_t *file, mach_msg_type_name_t *file_type) +{ + return EOPNOTSUPP; +} -- cgit v1.2.3