Permalink
Browse files

import FreeBSD sources as of 19990725

no functional changes, just:
* christos's NetBSD patches were applied
* code has been changed to use udev_t (on FreeBSD)
  • Loading branch information...
1 parent 1cc3526 commit 20a06b82f312f72453c271a6c90a33391ce8283d jdolecek committed Jul 26, 1999
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs.h,v 1.1.1.2 1999/07/26 13:48:20 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs.h,v 1.4 1999/04/20 21:06:41 semenu Exp
+ * Id: ntfs.h,v 1.5 1999/05/12 09:42:51 semenu Exp
*/
/*#define NTFS_DEBUG 1*/
@@ -286,6 +288,32 @@ MALLOC_DECLARE(M_NTFSDIR);
MALLOC_DECLARE(M_NTFSNTHASH);
#endif
+#ifdef __NetBSD__
+#define MALLOC_DEFINE(a, b, c)
+#define M_NTFSNTHASH M_TEMP
+#define M_NTFSNTVATTR M_TEMP
+#define M_NTFSRDATA M_TEMP
+#define M_NTFSRUN M_TEMP
+#define M_NTFSDECOMP M_TEMP
+#define M_NTFSMNT M_TEMP
+#define M_NTFSNTNODE M_TEMP
+#define M_NTFSFNODE M_TEMP
+#define M_NTFSDIR M_TEMP
+typedef int (vop_t) __P((void *));
+#define HASHINIT(a, b, c, d) hashinit((a), (b), (c), (d))
+#define bqrelse(bp) brelse(bp)
+#define VOP__LOCK(a, b, c) VOP_LOCK((a), (b) ? LK_EXCLUSIVE : LK_SHARED)
+#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), 0)
+#define VGET(a, b, c) vget((a), LK_EXCLUSIVE)
+#define VN_LOCK(a, b, c) vn_lock((a), LK_EXCLUSIVE)
+#else
+#define HASHINIT(a, b, c, d) hashinit((a), (b), (d))
+#define VOP__LOCK(a, b, c) VOP_LOCK((a), (b), (c))
+#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), (b), (c))
+#define VGET(a, b, c) vget((a), (b), (c))
+#define VN_LOCK(a, b, c) vn_lock((a), (b), (c))
+#endif
+
#if defined(NTFS_DEBUG)
#define dprintf(a) printf a
#if NTFS_DEBUG > 1
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_compr.c,v 1.1.1.2 1999/07/26 13:48:21 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_compr.c,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_compr.c,v 1.4 1999/05/12 09:42:54 semenu Exp
*/
#include <sys/param.h>
@@ -36,7 +38,9 @@
#include <sys/buf.h>
#include <sys/file.h>
#include <sys/malloc.h>
+#ifdef __FreeBSD__
#include <machine/clock.h>
+#endif
#include <miscfs/specfs/specdev.h>
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_compr.h,v 1.1.1.2 1999/07/26 13:48:21 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_compr.h,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_compr.h,v 1.4 1999/05/12 09:42:55 semenu Exp
*/
#define NTFS_COMPBLOCK_SIZE 0x1000
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_extern.h,v 1.1.1.2 1999/07/26 13:48:22 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_extern.h,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_extern.h,v 1.4 1999/05/12 09:42:57 semenu Exp
*/
struct sockaddr;
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_ihash.c,v 1.1.1.2 1999/07/26 13:48:22 jdolecek Exp $ */
+
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
@@ -31,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
- * Id: ntfs_ihash.c,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_ihash.c,v 1.5 1999/05/12 09:42:58 semenu Exp
*/
#include <sys/param.h>
@@ -53,7 +55,7 @@ MALLOC_DEFINE(M_NTFSNTHASH, "NTFS nthash", "NTFS ntnode hash tables");
*/
static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl;
static u_long ntfs_nthash; /* size of hash table - 1 */
-#define NTNOHASH(device, inum) (&ntfs_nthashtbl[((device) + (inum)) & ntfs_nthash])
+#define NTNOHASH(device, inum) (&ntfs_nthashtbl[(minor(device) + (inum)) & ntfs_nthash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ntfs_nthash_slock;
#endif
@@ -65,7 +67,8 @@ void
ntfs_nthashinit()
{
- ntfs_nthashtbl = hashinit(desiredvnodes, M_NTFSNTHASH, &ntfs_nthash);
+ ntfs_nthashtbl = HASHINIT(desiredvnodes, M_NTFSNTHASH, M_WAITOK,
+ &ntfs_nthash);
simple_lock_init(&ntfs_nthash_slock);
}
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_ihash.h,v 1.1.1.2 1999/07/26 13:48:23 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_ihash.h,v 1.2 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_ihash.h,v 1.3 1999/05/12 09:42:59 semenu Exp
*/
void ntfs_nthashinit __P((void));
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_inode.h,v 1.1.1.2 1999/07/26 13:48:23 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,21 +25,20 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_inode.h,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_inode.h,v 1.4 1999/05/12 09:43:00 semenu Exp
*/
/* These flags are kept in i_flag. */
-#if __FreeBSD_version >= 300000
+#if defined(__FreeBSD__)
#define IN_ACCESS 0x0001 /* Access time update request. */
#define IN_CHANGE 0x0002 /* Inode change time update request. */
#define IN_UPDATE 0x0004 /* Modification time update request. */
#define IN_MODIFIED 0x0008 /* Inode has been modified. */
#define IN_RENAME 0x0010 /* Inode is being renamed. */
#define IN_SHLOCK 0x0020 /* File has shared lock. */
#define IN_EXLOCK 0x0040 /* File has exclusive lock. */
-#define IN_HASHED 0x0080 /* Inode is on hash list */
-#define IN_LAZYMOD 0x0100 /* Modified, but don't write yet. */
-#else
+#define IN_LAZYMOD 0x0080 /* Modified, but don't write yet. */
+#else /* defined(__NetBSD__) */
#define IN_ACCESS 0x0001 /* Access time update request. */
#define IN_CHANGE 0x0002 /* Inode change time update request. */
#define IN_EXLOCK 0x0004 /* File has exclusive lock. */
@@ -51,6 +52,7 @@
#define IN_RECURSE 0x0400 /* Recursion expected */
#endif
+#define IN_HASHED 0x0800 /* Inode is on hash list */
#define IN_LOADED 0x8000 /* ntvattrs loaded */
#define IN_PRELOADED 0x4000 /* loaded from directory entry */
@@ -64,7 +66,11 @@ struct ntnode {
u_int32_t i_flag;
int i_lock;
int i_usecount;
-
+#if defined(__NetBSD__)
+ pid_t i_lockholder;
+ pid_t i_lockwaiter;
+ int i_lockcount;
+#endif
LIST_HEAD(,fnode) i_fnlist;
LIST_HEAD(,ntvattr) i_valist;
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_subr.c,v 1.1.1.2 1999/07/26 13:48:25 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org)
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_subr.c,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_subr.c,v 1.4 1999/05/12 09:43:01 semenu Exp
*/
#include <sys/param.h>
@@ -37,7 +39,9 @@
#include <sys/buf.h>
#include <sys/file.h>
#include <sys/malloc.h>
+#if defined(__FreeBSD__)
#include <machine/clock.h>
+#endif
#include <miscfs/specfs/specdev.h>
@@ -51,7 +55,7 @@
#include <ntfs/ntfs_compr.h>
#include <ntfs/ntfs_ihash.h>
-#if __FreeBSD_version >= 300000
+#if defined(__FreeBSD__)
MALLOC_DEFINE(M_NTFSNTVATTR, "NTFS vattr", "NTFS file attribute information");
MALLOC_DEFINE(M_NTFSRDATA, "NTFS res data", "NTFS resident data");
MALLOC_DEFINE(M_NTFSRUN, "NTFS vrun", "NTFS vrun storage");
@@ -684,9 +688,9 @@ ntfs_uustricmp(
int
ntfs_uastricmp(
struct ntfsmount * ntmp,
- wchar * str1,
+ const wchar *str1,
int str1len,
- char *str2,
+ const char *str2,
int str2len)
{
int i;
@@ -706,10 +710,10 @@ ntfs_uastricmp(
*/
int
ntfs_uastrcmp(
- struct ntfsmount * ntmp,
- wchar * str1,
+ struct ntfsmount *ntmp,
+ const wchar *str1,
int str1len,
- char *str2,
+ const char *str2,
int str2len)
{
int i;
@@ -810,13 +814,13 @@ ntfs_frele(
int
ntfs_ntlookupattr(
struct ntfsmount * ntmp,
- char * name,
+ const char * name,
int namelen,
int *attrtype,
char **attrname)
{
- char *sys;
- int syslen,i;
+ const char *sys;
+ size_t syslen, i;
struct ntvattrdef *adp;
if (namelen == 0)
@@ -882,7 +886,7 @@ ntfs_ntlookupfile(
u_int32_t rdsize; /* Length of data to read from current block */
struct attr_indexentry *iep;
int error, res, anamelen, fnamelen;
- char *fname,*aname;
+ const char *fname,*aname;
u_int32_t aoff;
error = ntfs_ntget(ip);
View
@@ -1,3 +1,5 @@
+/* $NetBSD: ntfs_subr.h,v 1.1.1.2 1999/07/26 13:48:26 jdolecek Exp $ */
+
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
* All rights reserved.
@@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Id: ntfs_subr.h,v 1.3 1999/04/20 21:06:43 semenu Exp
+ * Id: ntfs_subr.h,v 1.4 1999/05/12 09:43:02 semenu Exp
*/
#define VA_LOADED 0x0001
@@ -92,8 +94,10 @@ struct timespec ntfs_nttimetounix __P(( u_int64_t ));
int ntfs_ntreaddir __P(( struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **));
wchar ntfs_toupper __P(( struct ntfsmount *, wchar ));
int ntfs_uustricmp __P(( struct ntfsmount *, wchar *, int, wchar *, int ));
-int ntfs_uastricmp __P(( struct ntfsmount *, wchar *, int, char *, int ));
-int ntfs_uastrcmp __P(( struct ntfsmount *, wchar *, int, char *, int ));
+int ntfs_uastricmp __P(( struct ntfsmount *, const wchar *, int, const char *,
+ int ));
+int ntfs_uastrcmp __P(( struct ntfsmount *, const wchar *, int, const char *,
+ int ));
int ntfs_runtovrun __P(( cn_t **, cn_t **, u_long *, u_int8_t *));
int ntfs_attrtontvattr __P(( struct ntfsmount *, struct ntvattr **, struct attr * ));
void ntfs_freentvattr __P(( struct ntvattr * ));
@@ -108,6 +112,6 @@ int ntfs_ntget __P((struct ntnode *));
void ntfs_ntrele __P((struct ntnode *));
void ntfs_ntput __P((struct ntnode *));
int ntfs_loadntnode __P(( struct ntfsmount *, struct ntnode * ));
-int ntfs_ntlookupattr(struct ntfsmount *, char *, int, int *, char **);
+int ntfs_ntlookupattr(struct ntfsmount *, const char *, int, int *, char **);
int ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *);
int ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *);
Oops, something went wrong.

0 comments on commit 20a06b8

Please sign in to comment.