summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-03-29 17:23:17 +0000
committerMiles Bader <miles@gnu.org>1996-03-29 17:23:17 +0000
commitbbf6c084cf6a059f3b09e52ac3291d986336a951 (patch)
treea06879b8ba065dbc1afccf41b923019259ebd242
parent607966ffd68f95b968d6d57df5167026f4cb6786 (diff)
(diskfs_null_dirstat): New function.
(diskfs_lookup_hard, diskfs_direnter, diskfs_dirremove_hard, diskfs_dirrewrite_hard): Renamed from versions without `_hard' suffix. Get rid of stuff now done by diskfs.
-rw-r--r--ext2fs/dir.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 1467f70d..68b496e4 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -89,6 +89,13 @@ struct dirstat
size_t diskfs_dirstat_size = sizeof (struct dirstat);
+/* Initialize DS such that diskfs_drop_dirstat will ignore it. */
+void
+diskfs_null_dirstat (struct dirstat *ds)
+{
+ ds->type = LOOKUP;
+}
+
static error_t
dirscanblock (vm_address_t blockoff, struct node *dp, int idx, char *name,
int namelen, enum lookup_type type, struct dirstat *ds,
@@ -97,8 +104,8 @@ dirscanblock (vm_address_t blockoff, struct node *dp, int idx, char *name,
/* Implement the diskfs_lookup from the diskfs library. See
<hurd/diskfs.h> for the interface specification. */
error_t
-diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
- struct node **npp, struct dirstat *ds, struct protid *cred)
+diskfs_lookup_hard (struct node *dp, char *name, enum lookup_type type,
+ struct node **npp, struct dirstat *ds, struct protid *cred)
{
error_t err;
ino_t inum;
@@ -128,12 +135,6 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
if (namelen > EXT2_NAME_LEN)
return ENAMETOOLONG;
- if (!S_ISDIR (dp->dn_stat.st_mode))
- return ENOTDIR;
- err = diskfs_access (dp, S_IEXEC, cred);
- if (err)
- return err;
-
try_again:
if (ds)
{
@@ -252,16 +253,6 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
assert (0);
}
- /* If we will be modifying the directory, make sure it's allowed. */
- if (type == RENAME
- || (type == REMOVE && inum)
- || (type == CREATE && !inum))
- {
- err = diskfs_checkdirmod (dp, np, cred);
- if (err)
- goto out;
- }
-
if ((type == CREATE || type == RENAME) && !inum && ds && ds->stat == LOOKING)
{
/* We didn't find any room, so mark ds to extend the dir */
@@ -466,11 +457,8 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, char *name,
only be made if the directory has been held locked continuously since
the preceding lookup call, and only if that call returned ENOENT. */
error_t
-diskfs_direnter(struct node *dp,
- char *name,
- struct node *np,
- struct dirstat *ds,
- struct protid *cred)
+diskfs_direnter_hard (struct node *dp, char *name, struct node *np,
+ struct dirstat *ds, struct protid *cred)
{
struct ext2_dir_entry *new;
int namelen = strlen (name);
@@ -610,9 +598,6 @@ diskfs_direnter(struct node *dp,
diskfs_file_update (dp, 1);
- if (dp->dirmod_reqs)
- diskfs_notice_dirchange (dp, DIR_CHANGED_NEW, name);
-
return 0;
}
@@ -622,7 +607,7 @@ diskfs_direnter(struct node *dp,
directory has been locked continously since the call to lookup, and
only if that call succeeded. */
error_t
-diskfs_dirremove(struct node *dp, struct dirstat *ds)
+diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
{
assert (ds->type == REMOVE);
assert (ds->stat == HERE_TIS);
@@ -647,9 +632,6 @@ diskfs_dirremove(struct node *dp, struct dirstat *ds)
diskfs_file_update (dp, 1);
- if (dp->dirmod_reqs)
- diskfs_notice_dirchange (dp, DIR_CHANGED_UNLINK, ds->entry->name);
-
return 0;
}
@@ -661,9 +643,7 @@ diskfs_dirremove(struct node *dp, struct dirstat *ds)
continuously since the call to lookup, and only if that call
succeeded. */
error_t
-diskfs_dirrewrite(struct node *dp,
- struct node *np,
- struct dirstat *ds)
+diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds)
{
assert (ds->type == RENAME);
assert (ds->stat == HERE_TIS);
@@ -676,17 +656,13 @@ diskfs_dirrewrite(struct node *dp,
diskfs_file_update (dp, 1);
- if (dp->dirmod_reqs)
- diskfs_notice_dirchange (dp, DIR_CHANGED_RENUMBER, ds->entry->name);
-
return 0;
}
/* Tell if DP is an empty directory (has only "." and ".." entries). */
/* This routine must be called from inside a catch_exception (). */
int
-diskfs_dirempty(struct node *dp,
- struct protid *cred)
+diskfs_dirempty (struct node *dp, struct protid *cred)
{
struct ext2_dir_entry *entry;
int curoff;