Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv3020/scripts
Modified Files:
compat.c rl.c
Log Message:
fix a few size problems in attrib.c, resync attrib.c and rl.c
Index: compat.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/compat.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -U2 -r1.10 -r1.11
--- compat.c 25 Feb 2002 04:30:08 -0000 1.10
+++ compat.c 5 Mar 2002 02:35:02 -0000 1.11
@@ -19,4 +19,8 @@
typedef unsigned long long u64;
+typedef struct {
+ volatile unsigned int lock;
+} rwlock_t;
+
#include "linux/fs/ntfs/types.h"
@@ -258,5 +262,5 @@
}
-void ntfs_debug_dump_runlist(const run_list *rl)
+void ntfs_debug_dump_runlist(const run_list_element *rl)
{
int abbr = 0; /* abbreviate long lists */
Index: rl.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/rl.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -U2 -r1.26 -r1.27
--- rl.c 25 Feb 2002 04:30:08 -0000 1.26
+++ rl.c 5 Mar 2002 02:35:02 -0000 1.27
@@ -5,19 +5,24 @@
/**
* rl_mm - run_list memmove
+ *
+ * It is up to the caller to serialize access to the run list @base.
*/
-static inline void rl_mm (run_list *base, int dst, int src, int size)
+static inline void rl_mm(run_list_element *base, int dst, int src, int size)
{
if ((dst != src) && (size > 0))
- memmove (base + dst, base + src, size * sizeof (run_list));
+ memmove (base + dst, base + src, size * sizeof (*base));
}
/**
* rl_mc - run_list memory copy
+ *
+ * It is up to the caller to serialize access to the run lists @dstbase and
+ * @srcbase.
*/
-static inline void rl_mc (run_list *dstbase, int dst, run_list *srcbase,
- int src, int size)
+static inline void rl_mc(run_list_element *dstbase, int dst,
+ run_list_element *srcbase, int src, int size)
{
if (size > 0)
- memcpy (dstbase+dst, srcbase+src, size * sizeof (run_list));
+ memcpy (dstbase+dst, srcbase+src, size * sizeof (*dstbase));
}
@@ -32,4 +37,6 @@
* memory, this function returns and entire page of memory.
*
+ * It is up to the caller to serialize access to the run list @orig.
+ *
* N.B. If the new allocation doesn't require a different number of pages in
* memory, the function will return the original pointer.
@@ -40,10 +47,11 @@
* -EINVAL, Invalid parameters were passed in.
*/
-static inline run_list * ntfs_rl_realloc (run_list *orig, int old, int new)
+static inline run_list_element *ntfs_rl_realloc(run_list_element *orig,
+ int old, int new)
{
- run_list *nrl;
+ run_list_element *nrl;
- old = PAGE_ALIGN (old * sizeof (run_list));
- new = PAGE_ALIGN (new * sizeof (run_list));
+ old = PAGE_ALIGN (old * sizeof (*orig));
+ new = PAGE_ALIGN (new * sizeof (*orig));
if (old == new)
return orig;
@@ -68,8 +76,10 @@
* must be adjacent.
*
+ * It is up to the caller to serialize access to the run lists @one and @two.
+ *
* Return: TRUE Success, the run_lists were merged
* FALSE Failure, the run_lists were not merged
*/
-static inline BOOL ntfs_rl_merge (run_list *one, run_list *two)
+static inline BOOL ntfs_rl_merge(run_list_element *one, run_list_element *two)
{
BUG_ON (!one || !two);
@@ -96,7 +106,9 @@
*
* Append a run_list after element @loc in @orig. Merge the right end of
- * the new run_list, if necesary. Adjust the size of the hole before the
+ * the new run_list, if necessary. Adjust the size of the hole before the
* appended run_list.
*
+ * It is up to the caller to serialize access to the run lists @orig and @new.
+ *
* Return: Pointer, The new, combined, run_list
*
@@ -104,13 +116,13 @@
* -EINVAL, Invalid parameters were passed in.
*/
-static inline run_list * ntfs_rl_append (run_list *orig, int osize,
- run_list *new, int nsize, int loc)
+static inline run_list_element *ntfs_rl_append(run_list_element *orig,
+ int osize, run_list_element *new, int nsize, int loc)
{
- run_list *res;
+ run_list_element *res;
BOOL right;
BUG_ON (!orig || !new);
- /* First, merge the right hand end, if necesary. */
+ /* First, merge the right hand end, if necessary. */
right = ntfs_rl_merge (new + nsize - 1, orig + loc + 1);
@@ -143,7 +155,9 @@
*
* Insert a run_list before element @loc in @orig. Merge the left end of
- * the new run_list, if necesary. Adjust the size of the hole after the
+ * the new run_list, if necessary. Adjust the size of the hole after the
* inserted run_list.
*
+ * It is up to the caller to serialize access to the run lists @orig and @new.
+ *
* Return: Pointer, The new, combined, run_list
*
@@ -151,8 +165,8 @@
* -EINVAL, Invalid parameters were passed in.
*/
-static inline run_list * ntfs_rl_insert (run_list *orig, int osize,
- run_list *new, int nsize, int loc)
+static inline run_list_element *ntfs_rl_insert(run_list_element *orig,
+ int osize, run_list_element *new, int nsize, int loc)
{
- run_list *res;
+ run_list_element *res;
BOOL left = FALSE;
BOOL disc = FALSE; /* Discontinuity */
@@ -232,5 +246,7 @@
*
* Replace the run_list at @loc with @new. Merge the left and right ends of
- * the inserted run_list, if necesary.
+ * the inserted run_list, if necessary.
+ *
+ * It is up to the caller to serialize access to the run lists @orig and @new.
*
* Return: Pointer, The new, combined, run_list
@@ -239,8 +255,8 @@
* -EINVAL, Invalid parameters were passed in.
*/
-static inline run_list * ntfs_rl_replace (run_list *orig, int osize,
- run_list *new, int nsize, int loc)
+static inline run_list_element *ntfs_rl_replace(run_list_element *orig,
+ int osize, run_list_element *new, int nsize, int loc)
{
- run_list *res;
+ run_list_element *res;
BOOL left = FALSE;
BOOL right;
@@ -282,4 +298,6 @@
* run_lists is necessary. Adjust the size of the holes either side.
*
+ * It is up to the caller to serialize access to the run lists @orig and @new.
+ *
* Return: Pointer, The new, combined, run_list
*
@@ -287,8 +305,8 @@
* -EINVAL, Invalid parameters were passed in.
*/
-static inline run_list * ntfs_rl_split (run_list *orig, int osize,
- run_list *new, int nsize, int loc)
+static inline run_list_element *ntfs_rl_split(run_list_element *orig, int osize,
+ run_list_element *new, int nsize, int loc)
{
- run_list *res;
+ run_list_element *res;
BUG_ON (!orig || !new);
@@ -321,4 +339,6 @@
* or completely within a hole in @drl.
*
+ * It is up to the caller to serialize access to the run lists @drl and @srl.
+ *
* Merging of run lists is necessary in two cases:
* 1. When attribute lists are used and a further extent is being mapped.
@@ -341,7 +361,7 @@
* -ERANGE, The run_lists overlap and cannot be merged.
*/
-run_list * merge_run_lists (run_list *drl, run_list *srl)
+run_list_element *merge_run_lists(run_list_element *drl, run_list_element *srl)
{
- run_list *nrl; /* New run list. */
+ run_list_element *nrl; /* New run list. */
int di, si; /* Current index into @[ds]rl. */
int sstart; /* First index with lcn > LCN_RL_NOT_MAPPED. */
@@ -510,4 +530,6 @@
* longer valid.
*
+ * It is up to the caller to serialize access to the run list @old_rl.
+ *
* Check the return value for error with IS_ERR(ret_val). If this is FALSE,
* the function was successful, the return value is the new run list, and if
@@ -527,12 +549,12 @@
* run list if overlap present and return error).
*/
-run_list *decompress_mapping_pairs(const ntfs_volume *vol,
- const ATTR_RECORD *attr, run_list *old_rl)
+run_list_element *decompress_mapping_pairs(const ntfs_volume *vol,
+ const ATTR_RECORD *attr, run_list_element *old_rl)
{
VCN vcn; /* Current vcn. */
LCN lcn; /* Current lcn. */
s64 deltaxcn; /* Change in [vl]cn. */
- run_list *rl = NULL; /* The output run_list. */
- run_list *rl2; /* Temporary run_list. */
+ run_list_element *rl = NULL; /* The output run_list. */
+ run_list_element *rl2; /* Temporary run_list. */
u8 *buf; /* Current position in mapping pairs array. */
u8 *attr_end; /* End of attribute. */
@@ -580,5 +602,5 @@
* operates on whole pages only.
*/
- if (((rlpos + 3) * sizeof(run_list)) > rlsize) {
+ if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) {
rl2 = ntfs_malloc_nofs(rlsize + (int)PAGE_SIZE);
if (unlikely(!rl2)) {
@@ -754,7 +776,7 @@
* pure_src
*/
-run_list *pure_src (BOOL contig, BOOL multi, int vcn, int len)
+run_list_element *pure_src (BOOL contig, BOOL multi, int vcn, int len)
{
- run_list *result;
+ run_list_element *result;
int fudge;
@@ -783,9 +805,9 @@
*/
static void pure_test (int test, BOOL contig, BOOL multi,
- int vcn, int len, run_list *file, int size)
+ int vcn, int len, run_list_element *file, int size)
{
- run_list *src;
- run_list *dst;
- run_list *res;
+ run_list_element *src;
+ run_list_element *dst;
+ run_list_element *res;
src = pure_src (contig, multi, vcn, len);
@@ -807,5 +829,5 @@
{
/* VCN, LCN, len */
- static run_list file1[] = {
+ static run_list_element file1[] = {
{ 0, -1, 100 }, /* HOLE */
{ 100, 1100, 100 }, /* DATA */
@@ -815,14 +837,14 @@
{ 500, -3, 0 } /* NOENT */
};
- static run_list file2[] = {
+ static run_list_element file2[] = {
{ 0, 1000, 100 }, /* DATA */
{ 100, -1, 100 }, /* HOLE */
{ 200, -3, 0 } /* NOENT */
};
- static run_list file3[] = {
+ static run_list_element file3[] = {
{ 0, 1000, 100 }, /* DATA */
{ 100, -3, 0 } /* NOENT */
};
- static run_list file4[] = {
+ static run_list_element file4[] = {
{ 0, -3, 0 } /* NOENT */
};
@@ -873,6 +895,6 @@
void zero (void)
{
- run_list *jim = NULL;
- run_list *bob = NULL;
+ run_list_element *jim = NULL;
+ run_list_element *bob = NULL;
bob = ntfs_rl_realloc (bob, 0, 3);
@@ -895,7 +917,7 @@
static void frag_combine (ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECORD *attr2, ATTR_RECORD *attr3)
{
- run_list *run1;
- run_list *run2;
- run_list *run3;
+ run_list_element *run1;
+ run_list_element *run2;
+ run_list_element *run3;
run1 = decompress_mapping_pairs (vol, attr1, NULL);
|