From owner-svn-soc-all@FreeBSD.ORG Tue May 22 20:24:16 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1A8B9106566B for ; Tue, 22 May 2012 20:24:14 +0000 (UTC) (envelope-from vbotton@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 20:24:14 +0000 Date: Tue, 22 May 2012 20:24:14 +0000 From: vbotton@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522202414.1A8B9106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236168 - soc2012/vbotton/ntfs_apple X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 20:24:16 -0000 Author: vbotton Date: Tue May 22 20:24:13 2012 New Revision: 236168 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236168 Log: Replace some Mac OS mutex with freebsd ones, delete code related to Finder Deleted: soc2012/vbotton/ntfs_apple/ntfs_sfm.c soc2012/vbotton/ntfs_apple/ntfs_sfm.h Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.h soc2012/vbotton/ntfs_apple/ntfs_attr_list.h soc2012/vbotton/ntfs_apple/ntfs_dir.h soc2012/vbotton/ntfs_apple/ntfs_index.h soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h soc2012/vbotton/ntfs_apple/ntfs_mft.h soc2012/vbotton/ntfs_apple/ntfs_vnops.h soc2012/vbotton/ntfs_apple/ntfs_volume.h Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.h Tue May 22 20:24:13 2012 (r236168) @@ -54,7 +54,7 @@ * when looking up attributes to specify that we want the unnamed attribute as * opposed to any attribute or a specific named attribute. */ -__private_extern__ ntfschar AT_UNNAMED[1]; +/*__private_extern__ ntfschar AT_UNNAMED[1]; __private_extern__ errno_t ntfs_attr_map_runlist(ntfs_inode *ni); @@ -66,7 +66,7 @@ __private_extern__ errno_t ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn, ntfs_rl_element **run, - ntfs_attr_search_ctx *ctx); + ntfs_attr_search_ctx *ctx);*/ static inline s64 ntfs_attr_size(const ATTR_RECORD *a) { @@ -162,7 +162,7 @@ ctx->is_first = 1; } -__private_extern__ void ntfs_attr_search_ctx_reinit(ntfs_attr_search_ctx *ctx); +/*__private_extern__ void ntfs_attr_search_ctx_reinit(ntfs_attr_search_ctx *ctx); __private_extern__ ntfs_attr_search_ctx *ntfs_attr_search_ctx_get( ntfs_inode *ni, MFT_RECORD *m); __private_extern__ void ntfs_attr_search_ctx_put(ntfs_attr_search_ctx *ctx); @@ -242,5 +242,5 @@ const s64 ofs, const u32 cnt, u8 *buf); __private_extern__ errno_t ntfs_resident_attr_write(ntfs_inode *ni, u8 *buf, u32 cnt, const s64 ofs); - +*/ #endif /* !_OSX_NTFS_ATTR_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_attr_list.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr_list.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_attr_list.h Tue May 22 20:24:13 2012 (r236168) @@ -47,7 +47,7 @@ #include "ntfs_layout.h" #include "ntfs_types.h" -__private_extern__ errno_t ntfs_attr_list_is_needed(ntfs_inode *ni, +/*__private_extern__ errno_t ntfs_attr_list_is_needed(ntfs_inode *ni, ATTR_LIST_ENTRY *skip_entry, BOOL *attr_list_is_needed); __private_extern__ errno_t ntfs_attr_list_delete(ntfs_inode *ni, @@ -62,7 +62,7 @@ __private_extern__ errno_t ntfs_attr_list_sync_extend(ntfs_inode *base_ni, MFT_RECORD *base_m, unsigned al_ofs, ntfs_attr_search_ctx *ctx); - +*/ /** * ntfs_attr_list_sync - update the attribute list content of an ntfs inode * @ni: base ntfs inode whose attribute list attribugte to update @@ -88,8 +88,8 @@ return ntfs_attr_list_sync_shrink(ni, start_ofs, ctx); } -__private_extern__ void ntfs_attr_list_entries_delete(ntfs_inode *ni, - ATTR_LIST_ENTRY *start_entry, ATTR_LIST_ENTRY *end_entry); +/*__private_extern__ void ntfs_attr_list_entries_delete(ntfs_inode *ni, + ATTR_LIST_ENTRY *start_entry, ATTR_LIST_ENTRY *end_entry);*/ /** * ntfs_attr_list_entry_delete - delete an attribute list entry Modified: soc2012/vbotton/ntfs_apple/ntfs_dir.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_dir.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_dir.h Tue May 22 20:24:13 2012 (r236168) @@ -60,7 +60,7 @@ } ntfs_dir_lookup_name; /* The little endian Unicode string $I30 as a global constant. */ -__private_extern__ ntfschar I30[5]; +/*__private_extern__ ntfschar I30[5]; __private_extern__ errno_t ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const signed uname_len, @@ -77,7 +77,7 @@ __private_extern__ errno_t ntfs_dir_entry_add(ntfs_inode *dir_ni, const FILENAME_ATTR *fn, const u32 fn_len, const leMFT_REF mref); - +*/ /** * struct _ntfs_dirhint - directory hint structure * Modified: soc2012/vbotton/ntfs_apple/ntfs_index.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_index.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_index.h Tue May 22 20:24:13 2012 (r236168) @@ -242,9 +242,9 @@ * * Allocate an index context and return it. */ -static inline ntfs_index_context *ntfs_index_ctx_alloc(void) +inline ntfs_index_context *ntfs_index_ctx_alloc(void) { - return OSMalloc(sizeof(ntfs_index_context), ntfs_malloc_tag); + return malloc(sizeof(ntfs_index_context), ntfs_malloc_tag); } /** @@ -354,7 +354,7 @@ ntfs_index_ctx_free(ictx); } -__private_extern__ void ntfs_index_ctx_unlock(ntfs_index_context *ictx); +/*__private_extern__ void ntfs_index_ctx_unlock(ntfs_index_context *ictx); __private_extern__ errno_t ntfs_index_ctx_relock(ntfs_index_context *ictx); @@ -377,7 +377,7 @@ __private_extern__ errno_t ntfs_index_entry_add_or_node_split( ntfs_index_context *ictx, const BOOL split_only, u32 entry_size, const void *key, const u32 key_len, - const void *data, const u32 data_len); + const void *data, const u32 data_len);*/ /** * ntfs_index_entry_add - add a key to an index Modified: soc2012/vbotton/ntfs_apple/ntfs_inode.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_inode.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_inode.h Tue May 22 20:24:13 2012 (r236168) @@ -40,19 +40,13 @@ #include #include -//#include #include #include #include #include #include #include -//#include - -//#include - -//#include -//#include +#include /* Forward declarations. */ typedef struct _ntfs_inode ntfs_inode; @@ -65,7 +59,6 @@ #include "ntfs_layout.h" #include "ntfs_runlist.h" -#include "ntfs_sfm.h" #include "ntfs_types.h" #include "ntfs_vnops.h" #include "ntfs_volume.h" @@ -74,20 +67,20 @@ struct _ntfs_inode { ntfs_inode_list_entry hash; /* Hash bucket list this inode is in. */ ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ - vnode_t vn; /* Vnode attached to the ntfs inode or NULL if + struct vnode *vn; /* Vnode attached to the ntfs inode or NULL if this is an extent ntfs inode. */ - SInt32 nr_refs; /* This is the number of usecount references on + int32_t nr_refs; /* This is the number of usecount references on the vnode of this inode that are held by ntfs driver internal entities. For extent mft records, this is always zero. */ - SInt32 nr_opens; /* This is the number of VNOP_OPEN() calls that + int32_t nr_opens; /* This is the number of VNOP_OPEN() calls that have happened on the vnode of this inode that have not had a matching VNOP_CLOSE() call yet. Note this applies only to base inodes and is incremented/decremented in the base inode for attribute/raw inode opens/closes, too. */ - lck_rw_t lock; /* Lock serializing changes to the inode such + struct mutex lock; /* Lock serializing changes to the inode such as inode truncation and directory content modification (both take the lock exclusive) and calls like readdir and file read (these @@ -125,7 +118,7 @@ struct timespec backup_time; /* Cache of field in the AFP_AfpInfo stream but in OS X time format. */ - FINDER_INFO finder_info; /* Cached Finder info from the + /*FINDER_INFO finder_info;*/ /* Cached Finder info from the AFP_AfpInfo stream. */ /* * If NInoAttr() is true, the below fields describe the attribute which @@ -242,14 +235,14 @@ per cb. */ }; }; - lck_mtx_t extent_lock; /* Lock for accessing/modifying the below . */ + struct mtx extent_lock; /* Lock for accessing/modifying the below . */ s32 nr_extents; /* For a base mft record, the number of attached extent inodes (0 if none), for extent records and for fake inodes describing an attribute this is -1 if the base inode at @base_ni is valid and 0 otherwise. */ u32 extent_alloc; /* Number of bytes allocated for the extent_nis array. */ - lck_mtx_t attr_nis_lock; /* Lock for accessing/modifying the below. */ + struct mtx attr_nis_lock; /* Lock for accessing/modifying the below. */ s32 nr_attr_nis; /* For a base inode, the number of loaded attribute inodes (0 if none). Ignored for attribut inodes and fake inodes. */ @@ -275,7 +268,7 @@ record. For fake inodes, the real (base) inode to which the attribute belongs. */ - lck_mtx_t *base_attr_nis_lock; /* Pointer to the base + struct mtx *base_attr_nis_lock; /* Pointer to the base inode attr_nis_lock or NULL. */ @@ -388,11 +381,11 @@ } \ static inline void NInoSet##flag(ntfs_inode *ni) \ { \ - (void)OSBitOrAtomic((u32)1 << NI_##flag, (UInt32*)&ni->flags); \ + ni->flags |= ((u32)1 << NI_##flag); \ } \ static inline void NInoClear##flag(ntfs_inode *ni) \ { \ - (void)OSBitAndAtomic(~((u32)1 << NI_##flag), (UInt32*)&ni->flags); \ + ni->flags &= ~((u32)1 << NI_##flag); \ } /* @@ -401,13 +394,13 @@ #define DEFINE_NINO_TEST_AND_SET_BIT_OPS(flag) \ static inline u32 NInoTestSet##flag(ntfs_inode *ni) \ { \ - return ((u32)OSBitOrAtomic((u32)1 << NI_##flag, \ - (UInt32*)&ni->flags) >> NI_##flag) & 1; \ + ni->flags |= ((u32)1 << NI_##flag); \ + return (u32)((ni->flags >> NI_##flag) & 1); \ } \ static inline u32 NInoTestClear##flag(ntfs_inode *ni) \ { \ - return ((u32)OSBitAndAtomic(~((u32)1 << NI_##flag), \ - (UInt32*)&ni->flags) >> NI_##flag) & 1; \ + ni->flags &= ~((u32)1 << NI_##flag); \ + return (u32)((ni->flags >> NI_##flag) & 1) \ } /* Emit the ntfs inode bitops functions. */ @@ -416,8 +409,7 @@ static inline void NInoClearAllocLocked(ntfs_inode *ni) { - (void)OSBitAndAtomic(~(((u32)1 << NI_Locked) | ((u32)1 << NI_Alloc)), - (UInt32*)&ni->flags); + ni->flags &= (~(((u32)1 << NI_Locked) | ((u32)1 << NI_Alloc))); } DEFINE_NINO_BIT_OPS(Deleted) @@ -448,9 +440,9 @@ DEFINE_NINO_BIT_OPS(ValidBackupTime) DEFINE_NINO_BIT_OPS(DirtyBackupTime) DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyBackupTime) -DEFINE_NINO_BIT_OPS(ValidFinderInfo) -DEFINE_NINO_BIT_OPS(DirtyFinderInfo) -DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyFinderInfo) +//DEFINE_NINO_BIT_OPS(ValidFinderInfo) +//DEFINE_NINO_BIT_OPS(DirtyFinderInfo) +//DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyFinderInfo) /* Function to bulk check all the Dirty* flags at once. */ static inline u32 NInoDirty(ntfs_inode *ni) @@ -496,10 +488,10 @@ BOOL raw; }; -__private_extern__ BOOL ntfs_inode_test(ntfs_inode *ni, const ntfs_attr *na); +/*__private_extern__ BOOL ntfs_inode_test(ntfs_inode *ni, const ntfs_attr *na); __private_extern__ errno_t ntfs_inode_init(ntfs_volume *vol, ntfs_inode *ni, - const ntfs_attr *na); + const ntfs_attr *na);*/ /** * ntfs_inode_wait - wait for an ntfs inode @@ -534,7 +526,7 @@ * ntfs_inode_wakeup - wakeup all processes waiting on an ntfs inode * @ni: ntfs inode to wake up */ -static inline void ntfs_inode_wakeup(ntfs_inode *ni) +inline void ntfs_inode_wakeup(ntfs_inode *ni) { wakeup(ni); } @@ -554,7 +546,7 @@ #define ntfs_inode_add_vnode(ni, is_system, parent_vn, cn) \ ntfs_inode_add_vnode_attr(ni, is_system, parent_vn, cn, FALSE/*isstream*/) -__private_extern__ errno_t ntfs_inode_add_vnode_attr(ntfs_inode *ni, +/*__private_extern__ errno_t ntfs_inode_add_vnode_attr(ntfs_inode *ni, const BOOL is_system, vnode_t parent_vn, struct componentname *cn, BOOL isstream); @@ -569,7 +561,7 @@ __private_extern__ errno_t ntfs_attr_inode_get_or_create(ntfs_inode *base_ni, ATTR_TYPE type, ntfschar *name, u32 name_len, const BOOL is_system, const BOOL raw, const int options, - const lck_rw_type_t lock, ntfs_inode **nni); + const lck_rw_type_t lock, ntfs_inode **nni);*/ /** * ntfs_attr_inode_get - obtain an ntfs inode corresponding to an attribute @@ -658,7 +650,7 @@ ni->name_len, FALSE, TRUE, XATTR_REPLACE, lock, nni); } -__private_extern__ errno_t ntfs_index_inode_get(ntfs_inode *base_ni, +/*__private_extern__ errno_t ntfs_index_inode_get(ntfs_inode *base_ni, ntfschar *name, u32 name_len, const BOOL is_system, ntfs_inode **nni); @@ -683,6 +675,6 @@ BOOL have_parent, MFT_REF *mref, const char *name); __private_extern__ errno_t ntfs_inode_is_parent(ntfs_inode *parent_ni, - ntfs_inode *child_ni, BOOL *is_parent, ntfs_inode *forbid_ni); + ntfs_inode *child_ni, BOOL *is_parent, ntfs_inode *forbid_ni);*/ #endif /* !_OSX_NTFS_INODE_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h Tue May 22 20:24:13 2012 (r236168) @@ -55,7 +55,7 @@ LAST_ZONE = 1, /* For sanity checking. */ } NTFS_CLUSTER_ALLOCATION_ZONES; -__private_extern__ errno_t ntfs_cluster_alloc(ntfs_volume *vol, +/*__private_extern__ errno_t ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn, const s64 count, const LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone, const BOOL is_extension, ntfs_runlist *runlist); @@ -65,6 +65,6 @@ s64 *nr_freed); __private_extern__ errno_t ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, ntfs_attr_search_ctx *ctx, - s64 *nr_freed); + s64 *nr_freed);*/ #endif /* !_OSX_NTFS_LCNALLOC_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_mft.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_mft.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_mft.h Tue May 22 20:24:13 2012 (r236168) @@ -45,8 +45,8 @@ #include "ntfs_types.h" #include "ntfs_volume.h" -__private_extern__ errno_t ntfs_mft_record_map_ext(ntfs_inode *ni, - MFT_RECORD **m, const BOOL mft_is_locked); +/*__private_extern__ errno_t ntfs_mft_record_map_ext(ntfs_inode *ni, + MFT_RECORD **m, const BOOL mft_is_locked);*/ /** * ntfs_mft_record_map - map and lock an mft record @@ -67,11 +67,11 @@ return ntfs_mft_record_map_ext(ni, m, FALSE); } -__private_extern__ void ntfs_mft_record_unmap(ntfs_inode *ni); +/*__private_extern__ void ntfs_mft_record_unmap(ntfs_inode *ni); __private_extern__ errno_t ntfs_extent_mft_record_map_ext(ntfs_inode *base_ni, MFT_REF mref, ntfs_inode **nni, MFT_RECORD **nm, - const BOOL mft_is_locked); + const BOOL mft_is_locked);*/ /** * ntfs_extent_mft_record_map - load an extent inode and attach it to its base @@ -102,7 +102,7 @@ ntfs_mft_record_unmap(ni); } -__private_extern__ errno_t ntfs_mft_record_sync(ntfs_inode *ni); +/*__private_extern__ errno_t ntfs_mft_record_sync(ntfs_inode *ni); __private_extern__ errno_t ntfs_mft_mirror_sync(ntfs_volume *vol, const s64 rec_no, const MFT_RECORD *m, const BOOL sync); @@ -113,6 +113,6 @@ ATTR_RECORD **new_a); __private_extern__ errno_t ntfs_extent_mft_record_free(ntfs_inode *base_ni, - ntfs_inode *ni, MFT_RECORD *m); + ntfs_inode *ni, MFT_RECORD *m);*/ #endif /* !_OSX_NTFS_MFT_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_vnops.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_vnops.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_vnops.h Tue May 22 20:24:13 2012 (r236168) @@ -44,10 +44,10 @@ typedef int vnop_t(void *); -__private_extern__ vnop_t **ntfs_vnodeop_p; +/*__private_extern__ vnop_t **ntfs_vnodeop_p; __private_extern__ struct vnodeopv_desc ntfs_vnodeopv_desc; -__private_extern__ int ntfs_cluster_iodone(buf_t cbp, void *arg __unused); +__private_extern__ int ntfs_cluster_iodone(buf_t cbp, void *arg __unused);*/ #endif /* !_OSX_NTFS_VNOPS_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_volume.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_volume.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_volume.h Tue May 22 20:24:13 2012 (r236168) @@ -119,7 +119,7 @@ ntfs_inode *mftbmp_ni; /* Attribute ntfs inode for $MFT/$BITMAP. */ - lck_rw_t mftbmp_lock; /* Lock for serializing accesses to the + struct rwlock mftbmp_lock; /* Lock for serializing accesses to the mft record bitmap ($MFT/$BITMAP) as well as to @nr_mft_records and @nr_free_mft_records. */ @@ -138,7 +138,7 @@ ntfs_inode *logfile_ni; /* The ntfs inode of $LogFile. */ ntfs_inode *lcnbmp_ni; /* The ntfs inode of $Bitmap. */ - lck_rw_t lcnbmp_lock; /* Lock for serializing accesses to the + struct rwlock lcnbmp_lock; /* Lock for serializing accesses to the cluster bitmap ($Bitmap/$DATA) as well as to @nr_clusters and @nr_free_clusters. */ @@ -152,7 +152,7 @@ u8 major_ver; /* Ntfs major version of volume. */ u8 minor_ver; /* Ntfs minor version of volume. */ - lck_mtx_t rename_lock; /* Lock serializing directory tree + struct mtx rename_lock; /* Lock serializing directory tree reshaping rename operations. */ ntfs_inode *root_ni; /* The ntfs inode of the root @@ -162,7 +162,7 @@ ntfs_inode *secure_sds_ni; /* Attribute inode of $Secure/$SDS. */ ntfs_inode *secure_sdh_ni; /* Index inode of $Secure/$SDH. */ ntfs_inode *secure_sii_ni; /* Index inode of $Secure/$SII. */ - lck_rw_t secure_lock; /* Lock for serializing accesses to the + struct rwlock secure_lock; /* Lock for serializing accesses to the $Secure related inodes. */ le32 next_security_id; /* The security_id to use the next time a new security descriptor is added @@ -196,7 +196,7 @@ ntfs_inode *usnjrnl_j_ni; /* Attribute inode for $UsnJrnl/$J. */ ntfs_inode_list_head inodes; /* List of all loaded ntfs_inodes. */ - lck_mtx_t inodes_lock; /* Lock protecting access to inodes + struct mtx inodes_lock; /* Lock protecting access to inodes list. */ };