summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsf <sf@openbsd.org>2017-08-14 22:45:12 +0000
committersf <sf@openbsd.org>2017-08-14 22:45:12 +0000
commitd7df32c5d9ed41f2834fca1a0822e76fea088197 (patch)
treea5646c3b4901e66a62a73d08406a885cce2a18ec
parentmsdofs: Add new CLUST_END constant (diff)
downloadwireguard-openbsd-d7df32c5d9ed41f2834fca1a0822e76fea088197.tar.xz
wireguard-openbsd-d7df32c5d9ed41f2834fca1a0822e76fea088197.zip
msdofs: Add new CLUST_END constant
(forgot to commit fat.h) Add new CLUST_END and use it as parameter to pcbmap() when searching for end cluster, instead of explicitly passing 0xffff. This fixes potential problem for FAT32, where cluster number may be legally bigger than 0xffff. Also change clusteralloc() so that fillwith is not explicitly passed by caller anymore (there is no need to use anything other than CLUST_EOFE). From NetBSD commit by jdolecek@NetBSD.org ok tb@ mpi@
-rw-r--r--sys/msdosfs/fat.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/msdosfs/fat.h b/sys/msdosfs/fat.h
index 1fd12af89d9..ad3ed47648b 100644
--- a/sys/msdosfs/fat.h
+++ b/sys/msdosfs/fat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fat.h,v 1.11 2015/10/23 10:45:31 krw Exp $ */
+/* $OpenBSD: fat.h,v 1.12 2017/08/14 22:45:12 sf Exp $ */
/* $NetBSD: fat.h,v 1.11 1997/10/17 11:23:49 ws Exp $ */
/*-
@@ -59,6 +59,7 @@
#define CLUST_BAD 0xfffffff7 /* a cluster with a defect */
#define CLUST_EOFS 0xfffffff8 /* start of eof cluster range */
#define CLUST_EOFE 0xffffffff /* end of eof cluster range */
+#define CLUST_END CLUST_EOFE /* bigger than any valid cluster */
#define FAT12_MASK 0x00000fff /* mask for 12 bit cluster numbers */
#define FAT16_MASK 0x0000ffff /* mask for 16 bit cluster numbers */
@@ -94,7 +95,7 @@
int pcbmap(struct denode *, uint32_t, daddr_t *, uint32_t *, int *);
int clusterfree(struct msdosfsmount *, uint32_t, uint32_t *);
-int clusteralloc(struct msdosfsmount *, uint32_t, uint32_t, uint32_t, uint32_t *, uint32_t *);
+int clusteralloc(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *, uint32_t *);
int extendfile(struct denode *, uint32_t, struct buf **, uint32_t *, int);
int fatentry(int, struct msdosfsmount *, uint32_t, uint32_t *, uint32_t);
void fc_purge(struct denode *, u_int);