diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-03-17 05:51:33 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-05 06:39:30 -0400 |
commit | 53d59aad9326199ef5749c97513db498309a057e (patch) | |
tree | 3fc3e99673cf5c5c8f275cca1ec7ed2dfe5fa192 /fs/ntfs/runlist.c | |
parent | 1ef334d372d6a7006e20f56f7e85d8f4ec32e3c2 (diff) |
NTFS: Fix compilation when configured read-only.
- Add ifdef NTFS_RW around write specific code if fs/ntfs/runlist.[hc] and
fs/ntfs/attrib.[hc].
- Minor bugfix to fs/ntfs/attrib.c::ntfs_attr_make_non_resident() where the
runlist was not freed in all error cases.
- Add fs/ntfs/runlist.[hc]::ntfs_rl_find_vcn_nolock().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/runlist.c')
-rw-r--r-- | fs/ntfs/runlist.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c index 3f479f176610..396d767c2cab 100644 --- a/fs/ntfs/runlist.c +++ b/fs/ntfs/runlist.c | |||
@@ -980,6 +980,39 @@ LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn) | |||
980 | return LCN_ENOENT; | 980 | return LCN_ENOENT; |
981 | } | 981 | } |
982 | 982 | ||
983 | #ifdef NTFS_RW | ||
984 | |||
985 | /** | ||
986 | * ntfs_rl_find_vcn_nolock - find a vcn in a runlist | ||
987 | * @rl: runlist to search | ||
988 | * @vcn: vcn to find | ||
989 | * | ||
990 | * Find the virtual cluster number @vcn in the runlist @rl and return the | ||
991 | * address of the runlist element containing the @vcn on success. | ||
992 | * | ||
993 | * Return NULL if @rl is NULL or @vcn is in an unmapped part/out of bounds of | ||
994 | * the runlist. | ||
995 | * | ||
996 | * Locking: The runlist must be locked on entry. | ||
997 | */ | ||
998 | runlist_element *ntfs_rl_find_vcn_nolock(runlist_element *rl, const VCN vcn) | ||
999 | { | ||
1000 | BUG_ON(vcn < 0); | ||
1001 | if (unlikely(!rl || vcn < rl[0].vcn)) | ||
1002 | return NULL; | ||
1003 | while (likely(rl->length)) { | ||
1004 | if (unlikely(vcn < rl[1].vcn)) { | ||
1005 | if (likely(rl->lcn >= LCN_HOLE)) | ||
1006 | return rl; | ||
1007 | return NULL; | ||
1008 | } | ||
1009 | rl++; | ||
1010 | } | ||
1011 | if (likely(rl->lcn == LCN_ENOENT)) | ||
1012 | return rl; | ||
1013 | return NULL; | ||
1014 | } | ||
1015 | |||
983 | /** | 1016 | /** |
984 | * ntfs_get_nr_significant_bytes - get number of bytes needed to store a number | 1017 | * ntfs_get_nr_significant_bytes - get number of bytes needed to store a number |
985 | * @n: number for which to get the number of bytes for | 1018 | * @n: number for which to get the number of bytes for |
@@ -1452,3 +1485,5 @@ int ntfs_rl_truncate_nolock(const ntfs_volume *vol, runlist *const runlist, | |||
1452 | ntfs_debug("Done."); | 1485 | ntfs_debug("Done."); |
1453 | return 0; | 1486 | return 0; |
1454 | } | 1487 | } |
1488 | |||
1489 | #endif /* NTFS_RW */ | ||