summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/Makefile2
-rw-r--r--ext2fs/balloc.c2
-rw-r--r--ext2fs/dir.c2
-rw-r--r--ext2fs/ext2_fs.h23
-rw-r--r--ext2fs/ext2fs.h26
-rw-r--r--ext2fs/ialloc.c5
-rw-r--r--ext2fs/pager.c7
-rw-r--r--ext2fs/xinl.c2
8 files changed, 59 insertions, 10 deletions
diff --git a/ext2fs/Makefile b/ext2fs/Makefile
index e0419d46..e83aab26 100644
--- a/ext2fs/Makefile
+++ b/ext2fs/Makefile
@@ -21,7 +21,7 @@ makemode := server
target = ext2fs
SRCS = balloc.c dir.c ext2fs.c getblk.c hyper.c ialloc.c \
- inode.c pager.c pokel.c truncate.c storeinfo.c msg.c
+ inode.c pager.c pokel.c truncate.c storeinfo.c msg.c xinl.c
OBJS = $(SRCS:.c=.o)
LCLHDRS = ext2fs.h ext2_fs.h ext2_fs_i.h bitmap.c
HURDLIBS = diskfs pager iohelp fshelp store threads ports ihash shouldbeinlibc
diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c
index a53e1116..7333123c 100644
--- a/ext2fs/balloc.c
+++ b/ext2fs/balloc.c
@@ -44,7 +44,7 @@
#include "ext2fs.h"
#include "bitmap.c"
-/* Returns a pointer to the first occurence of CH in the buffer BUF of len
+/* Returns a pointer to the first occurrence of CH in the buffer BUF of len
LEN, or BUF + LEN if CH doesn't occur. */
static inline void *
memscan (void *buf, unsigned char ch, size_t len)
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 66d8c8a6..d70dbf32 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -698,7 +698,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
/* Following a lookup call for REMOVE, this removes the link from the
directory. DP is the directory being changed and DS is the cached
information returned from lookup. This call is only valid if the
- directory has been locked continously since the call to lookup, and
+ directory has been locked continuously since the call to lookup, and
only if that call succeeded. */
error_t
diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
diff --git a/ext2fs/ext2_fs.h b/ext2fs/ext2_fs.h
index a8f922e1..b1caeefa 100644
--- a/ext2fs/ext2_fs.h
+++ b/ext2fs/ext2_fs.h
@@ -203,6 +203,29 @@ struct ext2_group_desc
#define EXT2_FL_USER_VISIBLE 0x00001FFF /* User visible flags */
#define EXT2_FL_USER_MODIFIABLE 0x000000FF /* User modifiable flags */
+/* Flags that should be inherited by new inodes from their parent. */
+#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
+ EXT2_SYNC_FL | EXT2_NODUMP_FL |\
+ EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\
+ EXT2_NOCOMP_FL)
+
+/* Flags that are appropriate for regular files (all but dir-specific ones). */
+#define EXT2_REG_FLMASK (~(0))
+
+/* Flags that are appropriate for non-directories/regular files. */
+#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
+
+/* Mask out flags that are inappropriate for the given type of inode. */
+static __inline__ __u32 ext2_mask_flags(mode_t mode, __u32 flags)
+{
+ if (S_ISDIR(mode))
+ return flags;
+ else if (S_ISREG(mode))
+ return flags & EXT2_REG_FLMASK;
+ else
+ return flags & EXT2_OTHER_FLMASK;
+}
+
/*
* ioctl commands
*/
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 1d490861..2ad4a9df 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -101,8 +101,11 @@ void pokel_flush (struct pokel *pokel);
/* Transfer all regions from FROM to POKEL, which must have the same pager. */
void pokel_inherit (struct pokel *pokel, struct pokel *from);
-#ifndef EXT2FS_EI
-#define EXT2FS_EI extern inline
+#include <features.h>
+#ifdef EXT2FS_DEFINE_EI
+#define EXT2FS_EI
+#else
+#define EXT2FS_EI __extern_inline
#endif
/* ---------------------------------------------------------------- */
@@ -110,6 +113,11 @@ void pokel_inherit (struct pokel *pokel, struct pokel *from);
#include <stdint.h>
+extern int test_bit (unsigned num, char *bitmap);
+
+extern int set_bit (unsigned num, char *bitmap);
+
+#if defined(__USE_EXTERN_INLINES) || defined(EXT2FS_DEFINE_EI)
/* Returns TRUE if bit NUM is set in BITMAP. */
EXT2FS_EI int
test_bit (unsigned num, char *bitmap)
@@ -138,6 +146,7 @@ clear_bit (unsigned num, char *bitmap)
const uint_fast32_t mask = 1 << (num & 31);
return (*bw & mask) ? (*bw &= ~mask, mask) : 0;
}
+#endif /* Use extern inlines. */
/* ---------------------------------------------------------------- */
@@ -294,6 +303,9 @@ struct ext2_group_desc *group_desc_image;
#define inode_group_num(inum) (((inum) - 1) / sblock->s_inodes_per_group)
+extern struct ext2_inode *dino (ino_t inum);
+
+#if defined(__USE_EXTERN_INLINES) || defined(EXT2FS_DEFINE_EI)
/* Convert an inode number to the dinode on disk. */
EXT2FS_EI struct ext2_inode *
dino (ino_t inum)
@@ -305,6 +317,7 @@ dino (ino_t inum)
block_t block = bg->bg_inode_table + (group_inum / inodes_per_block);
return ((struct ext2_inode *)bptr(block)) + group_inum % inodes_per_block;
}
+#endif /* Use extern inlines. */
/* ---------------------------------------------------------------- */
/* inode.c */
@@ -333,6 +346,14 @@ struct pokel global_pokel;
char *modified_global_blocks;
spin_lock_t modified_global_blocks_lock;
+extern int global_block_modified (block_t block);
+extern void record_global_poke (void *ptr);
+extern void sync_global_ptr (void *bptr, int wait);
+extern void record_indir_poke (struct node *node, void *ptr);
+extern void sync_global (int wait);
+extern void alloc_sync (struct node *np);
+
+#if defined(__USE_EXTERN_INLINES) || defined(EXT2FS_DEFINE_EI)
/* Marks the global block BLOCK as being modified, and returns true if we
think it may have been clean before (but we may not be sure). Note that
this isn't enough to cause the block to be synced; you must call
@@ -401,6 +422,7 @@ alloc_sync (struct node *np)
diskfs_set_hypermetadata (1, 0);
}
}
+#endif /* Use extern inlines. */
/* ---------------------------------------------------------------- */
/* getblk.c */
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 22d911b5..15c17a4e 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -315,9 +315,8 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
}
/* Propagate initial inode flags from the directory, as Linux does. */
- np->dn->info.i_flags = dir->dn->info.i_flags;
- if (S_ISLNK (mode))
- np->dn->info.i_flags &= ~(EXT2_IMMUTABLE_FL | EXT2_APPEND_FL);
+ np->dn->info.i_flags =
+ ext2_mask_flags(mode, dir->dn->info.i_flags & EXT2_FL_INHERITED);
st->st_flags = 0;
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index 3f4674b4..0136f9b1 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -119,7 +119,7 @@ free_page_buf (void *buf)
/* Find the location on disk of page OFFSET in NODE. Return the disk block
in BLOCK (if unallocated, then return 0). If *LOCK is 0, then a reader
- lock is aquired on NODE's ALLOC_LOCK before doing anything, and left
+ lock is acquired on NODE's ALLOC_LOCK before doing anything, and left
locked after the return -- even if an error is returned. 0 is returned
on success otherwise an error code. */
static error_t
@@ -851,7 +851,10 @@ drop_pager_softrefs (struct node *node)
spin_unlock (&node_to_page_lock);
if (MAY_CACHE && pager)
- pager_change_attributes (pager, 0, MEMORY_OBJECT_COPY_DELAY, 0);
+ {
+ pager_sync (pager, 0);
+ pager_change_attributes (pager, 0, MEMORY_OBJECT_COPY_DELAY, 0);
+ }
if (pager)
ports_port_deref (pager);
}
diff --git a/ext2fs/xinl.c b/ext2fs/xinl.c
new file mode 100644
index 00000000..9f37e166
--- /dev/null
+++ b/ext2fs/xinl.c
@@ -0,0 +1,2 @@
+#define EXT2FS_DEFINE_EI
+#include "ext2fs.h"