CVS commit: src/sys/net
Module Name:src Committed By: knakahara Date: Wed Aug 10 05:56:30 UTC 2016 Modified Files: src/sys/net: files.net Log Message: follow renaming ifmpls to mpls. This fixes i386 ALL build. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/net/files.net Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: knakahara Date: Wed Aug 10 05:56:30 UTC 2016 Modified Files: src/sys/net: files.net Log Message: follow renaming ifmpls to mpls. This fixes i386 ALL build. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/net/files.net Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/files.net diff -u src/sys/net/files.net:1.9 src/sys/net/files.net:1.10 --- src/sys/net/files.net:1.9 Tue Apr 5 22:51:01 2016 +++ src/sys/net/files.net Wed Aug 10 05:56:30 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.net,v 1.9 2016/04/05 22:51:01 pgoyette Exp $ +# $NetBSD: files.net,v 1.10 2016/08/10 05:56:30 knakahara Exp $ # XXX CLEANUP define net @@ -25,7 +25,7 @@ file net/if_ieee1394subr.c ieee1394 file net/if_llatbl.c inet | inet6 file net/if_loop.c loop file net/if_media.c net -file net/if_mpls.c ifmpls needs-flag +file net/if_mpls.c mpls needs-flag file net/if_ppp.c ppp needs-flag file net/if_srt.c srt file net/if_stf.c stf & inet & inet6 needs-flag
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Wed Aug 10 04:52:40 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: restructure wm(4) evcnt to support multiqueue evcnt. ok by msaitou@n.o. To generate a diff of this commit: cvs rdiff -u -r1.416 -r1.417 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.416 src/sys/dev/pci/if_wm.c:1.417 --- src/sys/dev/pci/if_wm.c:1.416 Mon Jul 11 06:14:51 2016 +++ src/sys/dev/pci/if_wm.c Wed Aug 10 04:52:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.416 2016/07/11 06:14:51 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.417 2016/08/10 04:52:40 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -81,11 +81,10 @@ * - Set LED correctly (based on contents in EEPROM) * - Rework how parameters are loaded from the EEPROM. * - Image Unique ID - * - restructure evcnt */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.416 2016/07/11 06:14:51 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.417 2016/08/10 04:52:40 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -254,6 +253,28 @@ static const uint32_t wm_82580_rxpbs_tab struct wm_softc; +#ifdef WM_EVENT_COUNTERS +#define WM_Q_EVCNT_DEFINE(qname, evname)\ + char qname##_##evname##_evcnt_name[sizeof("qname##XX##evname")]; \ + struct evcnt qname##_ev_##evname; + +#define WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, evtype) \ + do{\ + snprintf((q)->qname##_##evname##_evcnt_name, \ + sizeof((q)->qname##_##evname##_evcnt_name), \ + "%s%02d%s", #qname, (qnum), #evname); \ + evcnt_attach_dynamic(&(q)->qname##_ev_##evname, \ + (evtype), NULL, (xname),\ + (q)->qname##_##evname##_evcnt_name); \ + }while(0) + +#define WM_Q_MISC_EVCNT_ATTACH(qname, evname, q, qnum, xname) \ + WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, EVCNT_TYPE_MISC) + +#define WM_Q_INTR_EVCNT_ATTACH(qname, evname, q, qnum, xname) \ + WM_Q_EVCNT_ATTACH(qname, evname, q, qnum, xname, EVCNT_TYPE_INTR) +#endif /* WM_EVENT_COUNTERS */ + struct wm_txqueue { kmutex_t *txq_lock; /* lock for tx operations */ @@ -302,7 +323,28 @@ struct wm_txqueue { int txq_flags; /* flags for H/W queue, see below */ #define WM_TXQ_NO_SPACE 0x1 - /* XXX which event counter is required? */ +#ifdef WM_EVENT_COUNTERS + WM_Q_EVCNT_DEFINE(txq, txsstall) /* Tx stalled due to no txs */ + WM_Q_EVCNT_DEFINE(txq, txdstall) /* Tx stalled due to no txd */ + WM_Q_EVCNT_DEFINE(txq, txfifo_stall) /* Tx FIFO stalls (82547) */ + WM_Q_EVCNT_DEFINE(txq, txdw) /* Tx descriptor interrupts */ + WM_Q_EVCNT_DEFINE(txq, txqe) /* Tx queue empty interrupts */ + /* XXX not used? */ + + WM_Q_EVCNT_DEFINE(txq, txipsum) /* IP checksums comp. out-bound */ + WM_Q_EVCNT_DEFINE(txq,txtusum) /* TCP/UDP cksums comp. out-bound */ + WM_Q_EVCNT_DEFINE(txq, txtusum6) /* TCP/UDP v6 cksums comp. out-bound */ + WM_Q_EVCNT_DEFINE(txq, txtso) /* TCP seg offload out-bound (IPv4) */ + WM_Q_EVCNT_DEFINE(txq, txtso6) /* TCP seg offload out-bound (IPv6) */ + WM_Q_EVCNT_DEFINE(txq, txtsopain) /* painful header manip. for TSO */ + + WM_Q_EVCNT_DEFINE(txq, txdrop) /* Tx packets dropped(too many segs) */ + + WM_Q_EVCNT_DEFINE(txq, tu) /* Tx underrun */ + + char txq_txseg_evcnt_names[WM_NTXSEGS][sizeof("txqXXtxsegXXX")]; + struct evcnt txq_ev_txseg[WM_NTXSEGS]; /* Tx packets w/ N segments */ +#endif /* WM_EVENT_COUNTERS */ }; struct wm_rxqueue { @@ -330,7 +372,12 @@ struct wm_rxqueue { struct mbuf *rxq_tail; struct mbuf **rxq_tailp; - /* XXX which event counter is required? */ +#ifdef WM_EVENT_COUNTERS + WM_Q_EVCNT_DEFINE(rxq, rxintr); /* Rx interrupts */ + + WM_Q_EVCNT_DEFINE(rxq, rxipsum); /* IP checksums checked in-bound */ + WM_Q_EVCNT_DEFINE(rxq, rxtusum); /* TCP/UDP cksums checked in-bound */ +#endif }; struct wm_queue { @@ -412,28 +459,9 @@ struct wm_softc { #ifdef WM_EVENT_COUNTERS /* Event counters. */ - struct evcnt sc_ev_txsstall; /* Tx stalled due to no txs */ - struct evcnt sc_ev_txdstall; /* Tx stalled due to no txd */ - struct evcnt sc_ev_txfifo_stall;/* Tx FIFO stalls (82547) */ - struct evcnt sc_ev_txdw; /* Tx descriptor interrupts */ - struct evcnt sc_ev_txqe; /* Tx queue empty interrupts */ - struct evcnt sc_ev_rxintr; /* Rx interrupts */ struct evcnt sc_ev_linkintr; /* Link interrupts */ - struct evcnt sc_ev_rxipsum; /* IP checksums checked in-bound */ - struct evcnt sc_ev_rxtusum; /* TCP/UDP cksums checked in-bound */ - struct evcnt sc_ev_txipsum; /* IP checksums comp. out-bound */ - struct evcnt sc_ev_txtusum; /* TCP/UDP cksums comp. out-bound */ - struct evcnt sc_ev_txtusum6; /* TCP/UDP v6 cksums comp. out-bound */ - struct evcnt sc_ev_txtso; /* TCP seg offload out-bound (IPv4) */ - struct evcnt sc_ev_txtso6; /* TCP seg offload out-bound
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Wed Aug 10 04:52:40 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: restructure wm(4) evcnt to support multiqueue evcnt. ok by msaitou@n.o. To generate a diff of this commit: cvs rdiff -u -r1.416 -r1.417 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: nonaka Date: Wed Aug 10 04:24:17 UTC 2016 Modified Files: src/sys/dev/sdmmc: sdhc.c sdmmcreg.h Log Message: Use 1.65-1.95 voltage window for 1.8V support. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sdmmc/sdmmcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.94 src/sys/dev/sdmmc/sdhc.c:1.95 --- src/sys/dev/sdmmc/sdhc.c:1.94 Sun Jul 3 11:55:27 2016 +++ src/sys/dev/sdmmc/sdhc.c Wed Aug 10 04:24:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.94 2016/07/03 11:55:27 kiyohara Exp $ */ +/* $NetBSD: sdhc.c,v 1.95 2016/08/10 04:24:17 nonaka Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.94 2016/07/03 11:55:27 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.95 2016/08/10 04:24:17 nonaka Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -484,7 +484,7 @@ sdhc_host_found(struct sdhc_softc *sc, b aprint_normal(" SDR104 HS200"); } if (ISSET(caps, SDHC_VOLTAGE_SUPP_1_8V)) { - SET(hp->ocr, MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V); + SET(hp->ocr, MMC_OCR_1_65V_1_95V); aprint_normal(" 1.8V"); } if (ISSET(caps, SDHC_VOLTAGE_SUPP_3_0V)) { @@ -910,7 +910,7 @@ sdhc_bus_power(sdmmc_chipset_handle_t sc * Select the lowest voltage according to capabilities. */ ocr &= hp->ocr; - if (ISSET(ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V)) { + if (ISSET(ocr, MMC_OCR_1_65V_1_95V)) { vdd = SDHC_VOLTAGE_1_8V; } else if (ISSET(ocr, MMC_OCR_2_9V_3_0V|MMC_OCR_3_0V_3_1V)) { vdd = SDHC_VOLTAGE_3_0V; Index: src/sys/dev/sdmmc/sdmmcreg.h diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.21 src/sys/dev/sdmmc/sdmmcreg.h:1.22 --- src/sys/dev/sdmmc/sdmmcreg.h:1.21 Thu Oct 29 22:37:15 2015 +++ src/sys/dev/sdmmc/sdmmcreg.h Wed Aug 10 04:24:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmcreg.h,v 1.21 2015/10/29 22:37:15 jmcneill Exp $ */ +/* $NetBSD: sdmmcreg.h,v 1.22 2016/08/10 04:24:17 nonaka Exp $ */ /* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -91,10 +91,7 @@ #define MMC_OCR_2_2V_2_3V (1<<10) #define MMC_OCR_2_1V_2_2V (1<<9) #define MMC_OCR_2_0V_2_1V (1<<8) -#define MMC_OCR_1_9V_2_0V (1<<7) -#define MMC_OCR_1_8V_1_9V (1<<6) -#define MMC_OCR_1_7V_1_8V (1<<5) -#define MMC_OCR_1_6V_1_7V (1<<4) +#define MMC_OCR_1_65V_1_95V (1<<7) /* R1 response type bits */ #define MMC_R1_READY_FOR_DATA (1<<8) /* ready for next transfer */
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: nonaka Date: Wed Aug 10 04:24:17 UTC 2016 Modified Files: src/sys/dev/sdmmc: sdhc.c sdmmcreg.h Log Message: Use 1.65-1.95 voltage window for 1.8V support. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sdmmc/sdmmcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 21:08:02 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extern.h ext2fs_htree.c Log Message: Undo revert now Christos has added the missing glue... To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/ext2fs_extern.h diff -u src/sys/ufs/ext2fs/ext2fs_extern.h:1.51 src/sys/ufs/ext2fs/ext2fs_extern.h:1.52 --- src/sys/ufs/ext2fs/ext2fs_extern.h:1.51 Tue Aug 9 20:03:05 2016 +++ src/sys/ufs/ext2fs/ext2fs_extern.h Tue Aug 9 21:08:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extern.h,v 1.51 2016/08/09 20:03:05 kre Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.52 2016/08/09 21:08:02 kre Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -79,6 +79,7 @@ struct mbuf; struct componentname; struct ufs_lookup_results; struct ext2fs_searchslot; +struct ext2fs_direct; extern struct pool ext2fs_inode_pool; /* memory pool for inodes */ extern struct pool ext2fs_dinode_pool; /* memory pool for dinodes */ @@ -132,6 +133,8 @@ int ext2fs_dirremove(struct vnode *, con int ext2fs_dirrewrite(struct inode *, const struct ufs_lookup_results *, struct inode *, struct componentname *); int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t); +int ext2fs_add_entry(struct vnode *, struct ext2fs_direct *, +const struct ufs_lookup_results *); /* ext2fs_subr.c */ int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **); @@ -184,6 +187,10 @@ int ext2fs_htree_hash(const char *, int, int ext2fs_htree_has_idx(struct inode *); int ext2fs_htree_lookup(struct inode *, const char *, int, struct buf **, int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); +int ext2fs_htree_create_index(struct vnode *, struct componentname *, +struct ext2fs_direct *); +int ext2fs_htree_add_entry(struct vnode *, struct ext2fs_direct *, +struct componentname *); __END_DECLS Index: src/sys/ufs/ext2fs/ext2fs_htree.c diff -u src/sys/ufs/ext2fs/ext2fs_htree.c:1.3 src/sys/ufs/ext2fs/ext2fs_htree.c:1.4 --- src/sys/ufs/ext2fs/ext2fs_htree.c:1.3 Tue Aug 9 20:03:05 2016 +++ src/sys/ufs/ext2fs/ext2fs_htree.c Tue Aug 9 21:08:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_htree.c,v 1.3 2016/08/09 20:03:05 kre Exp $ */ +/* $NetBSD: ext2fs_htree.c,v 1.4 2016/08/09 21:08:02 kre Exp $ */ /*- * Copyright (c) 2010, 2012 Zheng Liu@@ -26,10 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/fs/ext2fs/ext2_htree.c 294653 2016-01-24 02:41:49Z pfg $ + * $FreeBSD: head/sys/fs/ext2fs/ext2fs_htree.c 294653 2016-01-24 02:41:49Z pfg $ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.3 2016/08/09 20:03:05 kre Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.4 2016/08/09 21:08:02 kre Exp $"); #include #include @@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include #include - +#include #include #include @@ -59,9 +59,13 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include +static int ext2fs_htree_find_leaf(struct inode *, const char *, int , +uint32_t *, uint8_t *, struct ext2fs_htree_lookup_info *); + int ext2fs_htree_has_idx(struct inode *ip) { + /* XXX ip->i_flags should have got checked here for IN_E3INDEX */ return EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) && (ip->i_din.e2fs_din->e2di_flags & EXT2_INDEX); } @@ -72,7 +76,6 @@ ext2fs_htree_get_block(struct ext2fs_htr return ep->h_blk & 0x00FF; } - static void ext2fs_htree_release(struct ext2fs_htree_lookup_info *info) { @@ -109,6 +112,555 @@ ext2fs_htree_get_hash(struct ext2fs_htre return ep->h_hash; } + +static void +ext2fs_htree_set_block(struct ext2fs_htree_entry *ep, uint32_t blk) +{ + ep->h_blk = blk; +} + +static void +ext2fs_htree_set_count(struct ext2fs_htree_entry *ep, uint16_t cnt) +{ + ((struct ext2fs_htree_count *)(ep))->h_entries_num = cnt; +} + +static void +ext2fs_htree_set_hash(struct ext2fs_htree_entry *ep, uint32_t hash) +{ + ep->h_hash = hash; +} + +static void +ext2fs_htree_set_limit(struct ext2fs_htree_entry *ep, uint16_t limit) +{ + ((struct ext2fs_htree_count *)(ep))->h_entries_max = limit; +} + +static uint32_t +ext2fs_htree_node_limit(struct inode *ip) +{ + struct m_ext2fs *fs; + uint32_t space; + + fs = ip->i_e2fs; + space = fs->e2fs_bsize - EXT2_DIR_REC_LEN(0); + + return space / sizeof(struct ext2fs_htree_entry); +} + +static int +ext2fs_htree_append_block(struct vnode *vp, char *data, +struct componentname *cnp, uint32_t blksize) +{ + struct iovec aiov; + struct uio auio; + struct inode *dp = VTOI(vp); + uint64_t cursize, newsize; + int error; + + cursize =
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 21:08:02 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extern.h ext2fs_htree.c Log Message: Undo revert now Christos has added the missing glue... To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 20:18:08 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_lookup.c Log Message: merge missing function. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/ufs/ext2fs/ext2fs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 20:18:08 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_lookup.c Log Message: merge missing function. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/ufs/ext2fs/ext2fs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/ext2fs_lookup.c diff -u src/sys/ufs/ext2fs/ext2fs_lookup.c:1.81 src/sys/ufs/ext2fs/ext2fs_lookup.c:1.82 --- src/sys/ufs/ext2fs/ext2fs_lookup.c:1.81 Sat Aug 6 17:39:48 2016 +++ src/sys/ufs/ext2fs/ext2fs_lookup.c Tue Aug 9 16:18:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_lookup.c,v 1.81 2016/08/06 21:39:48 jdolecek Exp $ */ +/* $NetBSD: ext2fs_lookup.c,v 1.82 2016/08/09 20:18:08 christos Exp $ */ /* * Modified for NetBSD 1.2E @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.81 2016/08/06 21:39:48 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.82 2016/08/09 20:18:08 christos Exp $"); #include #include @@ -816,33 +816,35 @@ ext2fs_dirbadentry(struct vnode *dp, str struct ufsmount *ump = VFSTOUFS(dp->v_mount); int dirblksiz = ump->um_dirblksiz; - const char *error_msg = NULL; - int reclen = fs2h16(de->e2d_reclen); - int namlen = de->e2d_namlen; - - if (reclen < EXT2FS_DIRSIZ(1)) /* e2d_namlen = 1 */ - error_msg = "rec_len is smaller than minimal"; - else if (reclen % 4 != 0) - error_msg = "rec_len % 4 != 0"; - else if (namlen > EXT2FS_MAXNAMLEN) - error_msg = "namlen > EXT2FS_MAXNAMLEN"; - else if (reclen < EXT2FS_DIRSIZ(namlen)) - error_msg = "reclen is too small for name_len"; - else if (entryoffsetinblock + reclen > dirblksiz) - error_msg = "directory entry across blocks"; - else if (fs2h32(de->e2d_ino) > - VTOI(dp)->i_e2fs->e2fs.e2fs_icount) - error_msg = "inode out of bounds"; - - if (error_msg != NULL) { - printf( "bad directory entry: %s\n" - "offset=%d, inode=%lu, rec_len=%d, name_len=%d \n", - error_msg, entryoffsetinblock, - (unsigned long) fs2h32(de->e2d_ino), - reclen, namlen); - panic("ext2fs_dirbadentry"); - } - return error_msg == NULL ? 0 : 1; + const char *error_msg = NULL; + int reclen = fs2h16(de->e2d_reclen); + int namlen = de->e2d_namlen; + + if (reclen < EXT2FS_DIRSIZ(1)) /* e2d_namlen = 1 */ + error_msg = "rec_len is smaller than minimal"; +#if 0 + else if (reclen % 4 != 0) + error_msg = "rec_len % 4 != 0"; +#endif + else if (namlen > EXT2FS_MAXNAMLEN) + error_msg = "namlen > EXT2FS_MAXNAMLEN"; + else if (reclen < EXT2FS_DIRSIZ(namlen)) + error_msg = "reclen is too small for name_len"; + else if (entryoffsetinblock + reclen > dirblksiz) + error_msg = "directory entry across blocks"; + else if (fs2h32(de->e2d_ino) > + VTOI(dp)->i_e2fs->e2fs.e2fs_icount) + error_msg = "inode out of bounds"; + + if (error_msg != NULL) { + printf( "bad directory entry: %s\n" + "offset=%d, inode=%lu, rec_len=%d, name_len=%d \n", + error_msg, entryoffsetinblock, + (unsigned long) fs2h32(de->e2d_ino), + reclen, namlen); + panic("ext2fs_dirbadentry"); + } + return error_msg == NULL ? 0 : 1; } /* @@ -855,18 +857,13 @@ ext2fs_dirbadentry(struct vnode *dp, str */ int ext2fs_direnter(struct inode *ip, struct vnode *dvp, - const struct ufs_lookup_results *ulr, - struct componentname *cnp) +const struct ufs_lookup_results *ulr, struct componentname *cnp) { - struct ext2fs_direct *ep, *nep; struct inode *dp; - struct buf *bp; struct ext2fs_direct newdir; struct iovec aiov; struct uio auio; - u_int dsize; - int error, loc, newentrysize, spacefree; - char *dirbuf; + int error, newentrysize; struct ufsmount *ump = VFSTOUFS(dvp->v_mount); int dirblksiz = ump->um_dirblksiz; @@ -882,6 +879,20 @@ ext2fs_direnter(struct inode *ip, struct } memcpy(newdir.e2d_name, cnp->cn_nameptr, (unsigned)cnp->cn_namelen + 1); newentrysize = EXT2FS_DIRSIZ(cnp->cn_namelen); + + if (ext2fs_htree_has_idx(dp)) { + error = ext2fs_htree_add_entry(dvp, , cnp); + if (error) { + dp->i_e2fs_flags&= ~EXT2_INDEX; + dp->i_flag |= IN_CHANGE | IN_UPDATE; + } + return error; + } + + /* + * TODO check if Htree index is not created for the directory then + * create one if directory entries get overflew the first dir-block + */ if (ulr->ulr_count == 0) { /* * If ulr_count is 0, then namei could find no @@ -912,9 +923,35 @@ ext2fs_direnter(struct inode *ip, struct dp->i_flag |= IN_CHANGE; uvm_vnp_setsize(dvp, ext2fs_size(dp)); } - return (error); + return error; } + error = ext2fs_add_entry(dvp, ,ulr); + + if (!error && ulr->ulr_endoff && ulr->ulr_endoff < ext2fs_size(dp)) + error = ext2fs_truncate(dvp, (off_t)ulr->ulr_endoff, IO_SYNC, + cnp->cn_cred); + return error; +} + +/* + * Insert an entry into the directory block. + * Compact the contents. + */ + +int +ext2fs_add_entry (struct
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 20:03:05 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extern.h ext2fs_htree.c Log Message: Revert previous. This work isn't complete enough to include yet, and the build of current really does need to go back to a working state. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 20:03:05 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extern.h ext2fs_htree.c Log Message: Revert previous. This work isn't complete enough to include yet, and the build of current really does need to go back to a working state. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/ext2fs_extern.h diff -u src/sys/ufs/ext2fs/ext2fs_extern.h:1.50 src/sys/ufs/ext2fs/ext2fs_extern.h:1.51 --- src/sys/ufs/ext2fs/ext2fs_extern.h:1.50 Tue Aug 9 07:15:35 2016 +++ src/sys/ufs/ext2fs/ext2fs_extern.h Tue Aug 9 20:03:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extern.h,v 1.50 2016/08/09 07:15:35 christos Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.51 2016/08/09 20:03:05 kre Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -79,7 +79,6 @@ struct mbuf; struct componentname; struct ufs_lookup_results; struct ext2fs_searchslot; -struct ext2fs_direct; extern struct pool ext2fs_inode_pool; /* memory pool for inodes */ extern struct pool ext2fs_dinode_pool; /* memory pool for dinodes */ @@ -133,8 +132,6 @@ int ext2fs_dirremove(struct vnode *, con int ext2fs_dirrewrite(struct inode *, const struct ufs_lookup_results *, struct inode *, struct componentname *); int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t); -int ext2fs_add_entry(struct vnode *, struct ext2fs_direct *, -const struct ufs_lookup_results *); /* ext2fs_subr.c */ int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **); @@ -187,10 +184,6 @@ int ext2fs_htree_hash(const char *, int, int ext2fs_htree_has_idx(struct inode *); int ext2fs_htree_lookup(struct inode *, const char *, int, struct buf **, int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); -int ext2fs_htree_create_index(struct vnode *, struct componentname *, -struct ext2fs_direct *); -int ext2fs_htree_add_entry(struct vnode *, struct ext2fs_direct *, -struct componentname *); __END_DECLS Index: src/sys/ufs/ext2fs/ext2fs_htree.c diff -u src/sys/ufs/ext2fs/ext2fs_htree.c:1.2 src/sys/ufs/ext2fs/ext2fs_htree.c:1.3 --- src/sys/ufs/ext2fs/ext2fs_htree.c:1.2 Tue Aug 9 07:15:35 2016 +++ src/sys/ufs/ext2fs/ext2fs_htree.c Tue Aug 9 20:03:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_htree.c,v 1.2 2016/08/09 07:15:35 christos Exp $ */ +/* $NetBSD: ext2fs_htree.c,v 1.3 2016/08/09 20:03:05 kre Exp $ */ /*- * Copyright (c) 2010, 2012 Zheng Liu@@ -26,10 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/fs/ext2fs/ext2fs_htree.c 294653 2016-01-24 02:41:49Z pfg $ + * $FreeBSD: head/sys/fs/ext2fs/ext2_htree.c 294653 2016-01-24 02:41:49Z pfg $ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.2 2016/08/09 07:15:35 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.3 2016/08/09 20:03:05 kre Exp $"); #include #include @@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include #include -#include + #include #include @@ -59,13 +59,9 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include -static int ext2fs_htree_find_leaf(struct inode *, const char *, int , -uint32_t *, uint8_t *, struct ext2fs_htree_lookup_info *); - int ext2fs_htree_has_idx(struct inode *ip) { - /* XXX ip->i_flags should have got checked here for IN_E3INDEX */ return EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) && (ip->i_din.e2fs_din->e2di_flags & EXT2_INDEX); } @@ -76,6 +72,7 @@ ext2fs_htree_get_block(struct ext2fs_htr return ep->h_blk & 0x00FF; } + static void ext2fs_htree_release(struct ext2fs_htree_lookup_info *info) { @@ -112,555 +109,6 @@ ext2fs_htree_get_hash(struct ext2fs_htre return ep->h_hash; } - -static void -ext2fs_htree_set_block(struct ext2fs_htree_entry *ep, uint32_t blk) -{ - ep->h_blk = blk; -} - -static void -ext2fs_htree_set_count(struct ext2fs_htree_entry *ep, uint16_t cnt) -{ - ((struct ext2fs_htree_count *)(ep))->h_entries_num = cnt; -} - -static void -ext2fs_htree_set_hash(struct ext2fs_htree_entry *ep, uint32_t hash) -{ - ep->h_hash = hash; -} - -static void -ext2fs_htree_set_limit(struct ext2fs_htree_entry *ep, uint16_t limit) -{ - ((struct ext2fs_htree_count *)(ep))->h_entries_max = limit; -} - -static uint32_t -ext2fs_htree_node_limit(struct inode *ip) -{ - struct m_ext2fs *fs; - uint32_t space; - - fs = ip->i_e2fs; - space = fs->e2fs_bsize - EXT2_DIR_REC_LEN(0); - - return space / sizeof(struct ext2fs_htree_entry); -} - -static int -ext2fs_htree_append_block(struct vnode *vp, char *data, -struct componentname *cnp, uint32_t blksize) -{ - struct iovec aiov; - struct uio auio; -
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 16:38:24 UTC 2016 Modified Files: src/sys/arch/mips/mips: vm_machdep.c Log Message: Sign extended uarea va appropriately for mips_dcache_inv_range To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 16:38:24 UTC 2016 Modified Files: src/sys/arch/mips/mips: vm_machdep.c Log Message: Sign extended uarea va appropriately for mips_dcache_inv_range To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/vm_machdep.c diff -u src/sys/arch/mips/mips/vm_machdep.c:1.152 src/sys/arch/mips/mips/vm_machdep.c:1.153 --- src/sys/arch/mips/mips/vm_machdep.c:1.152 Tue Aug 9 09:02:10 2016 +++ src/sys/arch/mips/mips/vm_machdep.c Tue Aug 9 16:38:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.153 2016/08/09 16:38:24 skrll Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.153 2016/08/09 16:38:24 skrll Exp $"); #include "opt_ddb.h" #include "opt_coredump.h" @@ -243,7 +243,7 @@ cpu_uarea_free(void *va) #ifdef MIPS3_PLUS if (MIPS_CACHE_VIRTUAL_ALIAS) - mips_dcache_inv_range((vaddr_t)va, USPACE); + mips_dcache_inv_range((intptr_t)va, USPACE); #endif for (const paddr_t epa = pa + USPACE; pa < epa; pa += PAGE_SIZE) {
Re: CVS commit: src/sys/arch/xen/x86
Le 08/08/2016 à 04:27, Cherry G. Mathew a écrit : On 2 August 2016 at 19:51, Maxime Villard> wrote: Module Name:src Committed By: maxv Date: Tue Aug 2 14:21:53 UTC 2016 Modified Files: src/sys/arch/xen/x86: x86_xpmap.c Log Message: Map the kernel text, rodata and data+bss independently on Xen, with respectively RX, R and RW. Hi - wondering why you're getting more divergence from generic x86 - We are not getting more divergence. is there a way to do this (and the pg_nx stuff for eg:) without having to special case this in Xen ? Not really. On a normal x86, when the kernel starts, the CPU does not yet have 64bit registers, paging, WP, NX, MSRs, etc. The kernel itself enables them, and to do so, it uses temporary variables and a temporary page tree before relocating itself at KERNBASE. All this needs to be done in assembly. On Xen, however, when the kernel starts, the CPU already has 64bit registers, paging etc, so the only thing the kernel has to do is creating its own page table, and for that purpose it also uses temporary variables, such as pg_nx. This time, it all can be done in C. This initialization process is referred to as the locore, and even if machdep and pmap can be shared between amd64<->i386<->PAE<->Xen, the locore cannot. When it comes to pg_nx, we cannot use pmap_pg_nx, since it is part of the pmap, which is shared and initialized later. For that same reason, we use nox_flag in assembly in the amd64 and i386 locores.
CVS commit: src/sys/arch/ia64/include
Module Name:src Committed By: scole Date: Tue Aug 9 13:45:45 UTC 2016 Modified Files: src/sys/arch/ia64/include: atomic.h Log Message: Rename some functions so any atomic ops from this file and/or can be used. May want to pare overlap in the future, but let's leave both options for now To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/atomic.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/ia64/include/atomic.h diff -u src/sys/arch/ia64/include/atomic.h:1.2 src/sys/arch/ia64/include/atomic.h:1.3 --- src/sys/arch/ia64/include/atomic.h:1.2 Mon Aug 8 17:44:24 2016 +++ src/sys/arch/ia64/include/atomic.h Tue Aug 9 13:45:45 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.2 2016/08/08 17:44:24 scole Exp $ */ +/* $NetBSD: atomic.h,v 1.3 2016/08/09 13:45:45 scole Exp $ */ /*- * Copyright (c) 1998 Doug Rabson @@ -28,14 +28,8 @@ * $FreeBSD: releng/10.1/sys/ia64/include/atomic.h 262004 2014-02-16 23:08:21Z marcel $ */ -#ifndef _MACHINE_ATOMIC_H_ -#define _MACHINE_ATOMIC_H_ - -/* XXX need these? -#define mb() __asm __volatile("mf") -#define wmb() mb() -#define rmb() mb() -*/ +#ifndef _IA64_ATOMIC_H_ +#define _IA64_ATOMIC_H_ /* * Various simple arithmetic on memory which is atomic in the presence @@ -391,20 +385,11 @@ atomic_fetchadd_long(volatile u_long *p, } /* - * XXX already defined in - * src/common/lib/libc/arch/ia64/atomic/atomic.S. Need to sort out - * what to do with this file and atomic.S. atomic.S version comments - * (from 2008) say it is not tested at all, but if it works we may not - * need anything in this file? - */ -#if 0 - -/* * atomic_swap_(volatile *p, v); */ static __inline uint32_t -atomic_swap_32(volatile uint32_t *p, uint32_t v) +ia64_atomic_swap_32(volatile uint32_t *p, uint32_t v) { uint32_t r; @@ -414,7 +399,7 @@ atomic_swap_32(volatile uint32_t *p, uin } static __inline uint64_t -atomic_swap_64(volatile uint64_t *p, uint64_t v) +ia64_atomic_swap_64(volatile uint64_t *p, uint64_t v) { uint64_t r; @@ -422,10 +407,9 @@ atomic_swap_64(volatile uint64_t *p, uin "r"(v), "m"(*p) : "memory"); return (r); } -#endif -#define atomic_swap_int atomic_swap_32 -#define atomic_swap_long atomic_swap_64 -#define atomic_swap_ptr atomic_swap_64 +#define ia64_atomic_swap_int ia64_atomic_swap_32 +#define ia64_atomic_swap_long ia64_atomic_swap_64 +#define ia64_atomic_swap_ptr ia64_atomic_swap_64 -#endif /* ! _MACHINE_ATOMIC_H_ */ +#endif /* ! _IA64_ATOMIC_H_ */
CVS commit: src/sys/arch/ia64/include
Module Name:src Committed By: scole Date: Tue Aug 9 13:45:45 UTC 2016 Modified Files: src/sys/arch/ia64/include: atomic.h Log Message: Rename some functions so any atomic ops from this file and/or can be used. May want to pare overlap in the future, but let's leave both options for now To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/atomic.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 13:18:50 UTC 2016 Modified Files: src/sys/ufs/ext2fs: Makefile ext2fs_extents.h Log Message: Revert previous - which itself (incorrectly) reverted the previous changes, breaking the build. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/ext2fs/Makefile \ src/sys/ufs/ext2fs/ext2fs_extents.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: kre Date: Tue Aug 9 13:18:50 UTC 2016 Modified Files: src/sys/ufs/ext2fs: Makefile ext2fs_extents.h Log Message: Revert previous - which itself (incorrectly) reverted the previous changes, breaking the build. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/ext2fs/Makefile \ src/sys/ufs/ext2fs/ext2fs_extents.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/Makefile diff -u src/sys/ufs/ext2fs/Makefile:1.3 src/sys/ufs/ext2fs/Makefile:1.4 --- src/sys/ufs/ext2fs/Makefile:1.3 Tue Aug 9 07:15:35 2016 +++ src/sys/ufs/ext2fs/Makefile Tue Aug 9 13:18:50 2016 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.3 2016/08/09 07:15:35 christos Exp $ +# $NetBSD: Makefile,v 1.4 2016/08/09 13:18:50 kre Exp $ INCSDIR= /usr/include/ufs/ext2fs -INCS= ext2fs.h ext2fs_dinode.h ext2fs_dir.h ext2fs_extern.h +INCS= ext2fs.h ext2fs_dinode.h ext2fs_dir.h ext2fs_extents.h ext2fs_extern.h .include Index: src/sys/ufs/ext2fs/ext2fs_extents.h diff -u src/sys/ufs/ext2fs/ext2fs_extents.h:1.3 src/sys/ufs/ext2fs/ext2fs_extents.h:1.4 --- src/sys/ufs/ext2fs/ext2fs_extents.h:1.3 Tue Aug 9 07:15:35 2016 +++ src/sys/ufs/ext2fs/ext2fs_extents.h Tue Aug 9 13:18:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extents.h,v 1.3 2016/08/09 07:15:35 christos Exp $ */ +/* $NetBSD: ext2fs_extents.h,v 1.4 2016/08/09 13:18:50 kre Exp $ */ /*- * Copyright (c) 2012, 2010 Zheng Liu@@ -32,6 +32,10 @@ #define _UFS_EXT2FS_EXT2FS_EXTENTS_H_ #include +#ifndef _KERNEL +#include +#endif + #include #define EXT4_EXT_MAGIC 0xf30a
Re: CVS commit: src/tests/lib/libc/sys
Date:Tue, 9 Aug 2016 12:02:44 + From:"Robert Elz"Message-ID: <20160809120244.9f9d0f...@cvs.netbsd.org> Ignore this part ... | Note that NetBSD mlock(2) talks about EINVAL for cases where the length | parameter is negative ... but that is a size_t - good luck having that | ever occur (the man page will soon be corrected as well.) I was reading the man page on a NetBSD-7 system ... didn't notice that the man page was already corrected in current until I went to fix it! kre
CVS commit: src/sys/uvm
Module Name:src Committed By: kre Date: Tue Aug 9 12:17:04 UTC 2016 Modified Files: src/sys/uvm: uvm_mmap.c Log Message: The only error that can occur from munlock() on NetBSD is ENOMEM. Make it be that way. To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_mmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: kre Date: Tue Aug 9 12:17:04 UTC 2016 Modified Files: src/sys/uvm: uvm_mmap.c Log Message: The only error that can occur from munlock() on NetBSD is ENOMEM. Make it be that way. To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_mmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/uvm/uvm_mmap.c diff -u src/sys/uvm/uvm_mmap.c:1.161 src/sys/uvm/uvm_mmap.c:1.162 --- src/sys/uvm/uvm_mmap.c:1.161 Sun Aug 7 10:07:58 2016 +++ src/sys/uvm/uvm_mmap.c Tue Aug 9 12:17:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_mmap.c,v 1.161 2016/08/07 10:07:58 maxv Exp $ */ +/* $NetBSD: uvm_mmap.c,v 1.162 2016/08/09 12:17:04 kre Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.161 2016/08/07 10:07:58 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.162 2016/08/09 12:17:04 kre Exp $"); #include "opt_compat_netbsd.h" #include "opt_pax.h" @@ -862,9 +862,10 @@ sys_munlock(struct lwp *l, const struct error = uvm_map_pageable(>p_vmspace->vm_map, addr, addr+size, true, 0); - if (error == EFAULT) - error = ENOMEM; - return error; + if (error) + return ENOMEM; + + return 0; } /*
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kre Date: Tue Aug 9 12:02:44 UTC 2016 Modified Files: src/tests/lib/libc/sys: t_mlock.c Log Message: This test should be testing how the kernel should behave, not how it actually (used to) behave when it was incorrect... Aside from a possible EPERM (which is not tested) the only error possible from mlock() is ENOMEM. POSIX also allows EINVAL if the address is not page aligned and the implementation does not round down to the previous page boundary, but NetBSD does. The kernel was recently fixed to return the correct errors for mlock() so now we really need the test to be checking them, and not expecting the incorrect errno values that the kernel used to return. Same for munlock() - there ENOMEM is the only possible error, again, EINVAL cannot happen as the kernel rounds to page boundaries. For munlock() the kernel has not yet been corrected (that is coming real soon...) and one of the munlock() tests will currently fail (as of the time this commit is made, hopefully not for much longer) as it should - it is indicating a kernel bug. Note that NetBSD mlock(2) talks about EINVAL for cases where the length parameter is negative ... but that is a size_t - good luck having that ever occur (the man page will soon be corrected as well.) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_mlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_mlock.c diff -u src/tests/lib/libc/sys/t_mlock.c:1.5 src/tests/lib/libc/sys/t_mlock.c:1.6 --- src/tests/lib/libc/sys/t_mlock.c:1.5 Wed Feb 26 20:49:26 2014 +++ src/tests/lib/libc/sys/t_mlock.c Tue Aug 9 12:02:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $ */ +/* $NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $"); +__RCSID("$NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $"); #include #include @@ -79,34 +79,47 @@ ATF_TC_HEAD(mlock_err, tc) ATF_TC_BODY(mlock_err, tc) { - unsigned long vmin = 0; - size_t len = sizeof(vmin); void *invalid_ptr; - int null_errno = ENOMEM; /* error expected for NULL */ - - if (sysctlbyname("vm.minaddress", , , NULL, 0) != 0) - atf_tc_fail("failed to read vm.minaddress"); + void *buf; - if (vmin > 0) - null_errno = EINVAL; /* NULL is not inside user VM */ + /* + * Any bad address must return ENOMEM (for lock & unlock) + */ + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock(NULL, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(null_errno, mlock(NULL, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(null_errno, mlock((char *)0, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(null_errno, munlock(NULL, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(null_errno, munlock((char *)0, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + + /* + * unlocking memory that is not locked is an error... + */ errno = 0; - ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); + + /* + * These are permitted to fail (EINVAL) but do not on NetBSD + */ + ATF_REQUIRE(mlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); + ATF_REQUIRE(munlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); + + (void)free(buf); /* * Try to create a pointer to an unmapped page - first after current
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kre Date: Tue Aug 9 12:02:44 UTC 2016 Modified Files: src/tests/lib/libc/sys: t_mlock.c Log Message: This test should be testing how the kernel should behave, not how it actually (used to) behave when it was incorrect... Aside from a possible EPERM (which is not tested) the only error possible from mlock() is ENOMEM. POSIX also allows EINVAL if the address is not page aligned and the implementation does not round down to the previous page boundary, but NetBSD does. The kernel was recently fixed to return the correct errors for mlock() so now we really need the test to be checking them, and not expecting the incorrect errno values that the kernel used to return. Same for munlock() - there ENOMEM is the only possible error, again, EINVAL cannot happen as the kernel rounds to page boundaries. For munlock() the kernel has not yet been corrected (that is coming real soon...) and one of the munlock() tests will currently fail (as of the time this commit is made, hopefully not for much longer) as it should - it is indicating a kernel bug. Note that NetBSD mlock(2) talks about EINVAL for cases where the length parameter is negative ... but that is a size_t - good luck having that ever occur (the man page will soon be corrected as well.) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_mlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 09:06:31 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S Log Message: Disable the USPACE cpu_switch_resume optimisation for 16KB PAGE_SIZE Always check for existing TLB entry and remove it Add a comment to say what's going on To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/arch/mips/mips/mipsX_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 09:06:31 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S Log Message: Disable the USPACE cpu_switch_resume optimisation for 16KB PAGE_SIZE Always check for existing TLB entry and remove it Add a comment to say what's going on To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/arch/mips/mips/mipsX_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/mipsX_subr.S diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.86 src/sys/arch/mips/mips/mipsX_subr.S:1.87 --- src/sys/arch/mips/mips/mipsX_subr.S:1.86 Tue Aug 9 08:59:08 2016 +++ src/sys/arch/mips/mips/mipsX_subr.S Tue Aug 9 09:06:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mipsX_subr.S,v 1.86 2016/08/09 08:59:08 skrll Exp $ */ +/* $NetBSD: mipsX_subr.S,v 1.87 2016/08/09 09:06:31 skrll Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -2713,15 +2713,28 @@ END(MIPSX(lwp_trampoline)) * Wiredown the USPACE of newproc in TLB entry#0. Check whether target * USPACE is already in another place of TLB before that, and make * sure TBIS(it) in the case. + * + * Disable the optimisation for PGSHIFT == 14 (aka ENABLE_MIPS_16KB_PAGE) + * as the code needs fixing for this case + * + * _LP64 with UPAGES == 1 is always direct mappable; everything else can have + * non-direct mappable USPACE. */ + LEAF_NOPROFILE(MIPSX(cpu_switch_resume)) +#if (PGSHIFT < 14) #if (USPACE > PAGE_SIZE) || !defined(_LP64) INT_L a1, L_MD_UPTE_0(a0) # a1 = upte[0] #if (PGSHIFT & 1) +#if (USPACE > PAGE_SIZE) +#error Unsupported +#else + /* even/odd are contiguaous */ INT_ADD a2, a1, MIPS3_PG_NEXT # a2 = upper half +#endif #else INT_L a2, L_MD_UPTE_1(a0) # a2 = upte[1] -#endif +#endif /* (PGSHIFT & 1) */ PTR_L v0, L_PCB(a0) # va = l->l_addr #if VM_MIN_KERNEL_ADDRESS == MIPS_KSEG2_START li t0, VM_MIN_KERNEL_ADDRESS # compute index @@ -2750,7 +2763,7 @@ MIPSX(entry0): #endif /* (PGSHIFT & 1) == 0 */ _MFC0 ta1, MIPS_COP_0_TLB_HI # save TLB_HI _MTC0 v0, MIPS_COP_0_TLB_HI # VPN = va -#if (PGSHIFT & 1) == 0 + COP0_SYNC tlbp # probe VPN COP0_SYNC @@ -2768,7 +2781,7 @@ MIPSX(entry0): _MTC0 v0, MIPS_COP_0_TLB_HI # set VPN again COP0_SYNC MIPSX(entry0set): -#endif /* (PGSHIFT & 1) == 0 */ + #ifdef MULTIPROCESSOR PTR_L t0, L_CPU(a0) # get cpu_info INT_L t1, CPU_INFO_KSP_TLB_SLOT(t0) # get TLB# for KSP @@ -2786,6 +2799,7 @@ MIPSX(entry0set): COP0_SYNC MIPSX(resume): #endif /* (USPACE > PAGE_SIZE) || !defined(_LP64) */ +#endif /* PGSHIFT < 14 */ #ifdef MIPSNNR2 PTR_L v0, L_PRIVATE(a0) # get lwp private _MTC0 v0, MIPS_COP_0_USERLOCAL # make available for rdhwr
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 09:02:10 UTC 2016 Modified Files: src/sys/arch/mips/mips: vm_machdep.c Log Message: Initialise md_upte for the new lwp KASSERT that we're always direct mapped when we expect to be To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 09:02:10 UTC 2016 Modified Files: src/sys/arch/mips/mips: vm_machdep.c Log Message: Initialise md_upte for the new lwp KASSERT that we're always direct mapped when we expect to be To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/vm_machdep.c diff -u src/sys/arch/mips/mips/vm_machdep.c:1.151 src/sys/arch/mips/mips/vm_machdep.c:1.152 --- src/sys/arch/mips/mips/vm_machdep.c:1.151 Tue Aug 9 08:59:08 2016 +++ src/sys/arch/mips/mips/vm_machdep.c Tue Aug 9 09:02:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.152 2016/08/09 09:02:10 skrll Exp $"); #include "opt_ddb.h" #include "opt_coredump.h" @@ -116,6 +116,10 @@ cpu_lwp_fork(struct lwp *l1, struct lwp l2->l_md.md_utf = tf; #if (USPACE > PAGE_SIZE) || !defined(_LP64) + CTASSERT(__arraycount(l2->l_md.md_upte) >= UPAGES); + for (u_int i = 0; i < __arraycount(l2->l_md.md_upte); i++) { + l2->l_md.md_upte[i] = 0; + } if (!pmap_md_direct_mapped_vaddr_p(ua2)) { CTASSERT((PGSHIFT == 12) == (UPAGES == 2)); pt_entry_t * const pte = pmap_pte_lookup(pmap_kernel(), ua2); @@ -128,6 +132,8 @@ cpu_lwp_fork(struct lwp *l1, struct lwp l2->l_md.md_upte[i] = pte[i] & ~x; } } +#else + KASSERT(pmap_md_direct_mapped_vaddr_p(ua2)); #endif /* * Rig kernel stack so that it would start out in lwp_trampoline()
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 08:59:08 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S vm_machdep.c Log Message: Fixup the #if to reflect when we can have non-direct mappable USPACE To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/mips/mips/mipsX_subr.S cvs rdiff -u -r1.150 -r1.151 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/mipsX_subr.S diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.85 src/sys/arch/mips/mips/mipsX_subr.S:1.86 --- src/sys/arch/mips/mips/mipsX_subr.S:1.85 Tue Aug 9 08:56:23 2016 +++ src/sys/arch/mips/mips/mipsX_subr.S Tue Aug 9 08:59:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mipsX_subr.S,v 1.85 2016/08/09 08:56:23 skrll Exp $ */ +/* $NetBSD: mipsX_subr.S,v 1.86 2016/08/09 08:59:08 skrll Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -2715,7 +2715,7 @@ END(MIPSX(lwp_trampoline)) * sure TBIS(it) in the case. */ LEAF_NOPROFILE(MIPSX(cpu_switch_resume)) -#if !defined(ENABLE_MIPS_16KB_PAGE) && !defined(ENABLE_MIPS_8KB_PAGE) +#if (USPACE > PAGE_SIZE) || !defined(_LP64) INT_L a1, L_MD_UPTE_0(a0) # a1 = upte[0] #if (PGSHIFT & 1) INT_ADD a2, a1, MIPS3_PG_NEXT # a2 = upper half @@ -2785,7 +2785,7 @@ MIPSX(entry0set): _MTC0 ta1, MIPS_COP_0_TLB_HI # restore TLB_HI COP0_SYNC MIPSX(resume): -#endif /* !ENABLE_MIPS_16KB_PAGE */ +#endif /* (USPACE > PAGE_SIZE) || !defined(_LP64) */ #ifdef MIPSNNR2 PTR_L v0, L_PRIVATE(a0) # get lwp private _MTC0 v0, MIPS_COP_0_USERLOCAL # make available for rdhwr Index: src/sys/arch/mips/mips/vm_machdep.c diff -u src/sys/arch/mips/mips/vm_machdep.c:1.150 src/sys/arch/mips/mips/vm_machdep.c:1.151 --- src/sys/arch/mips/mips/vm_machdep.c:1.150 Sun Jul 31 15:33:42 2016 +++ src/sys/arch/mips/mips/vm_machdep.c Tue Aug 9 08:59:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.150 2016/07/31 15:33:42 skrll Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.150 2016/07/31 15:33:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.151 2016/08/09 08:59:08 skrll Exp $"); #include "opt_ddb.h" #include "opt_coredump.h" @@ -115,9 +115,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp tf->tf_regs[_R_SP] = (intptr_t)stack + stacksize; l2->l_md.md_utf = tf; -#if (USPACE > PAGE_SIZE) +#if (USPACE > PAGE_SIZE) || !defined(_LP64) if (!pmap_md_direct_mapped_vaddr_p(ua2)) { - __CTASSERT((PGSHIFT & 1) || UPAGES % 2 == 0); + CTASSERT((PGSHIFT == 12) == (UPAGES == 2)); pt_entry_t * const pte = pmap_pte_lookup(pmap_kernel(), ua2); const uint32_t x = MIPS_HAS_R4K_MMU ? (MIPS3_PG_RO | MIPS3_PG_WIRED)
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 08:59:08 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S vm_machdep.c Log Message: Fixup the #if to reflect when we can have non-direct mappable USPACE To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/mips/mips/mipsX_subr.S cvs rdiff -u -r1.150 -r1.151 src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 08:56:23 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S Log Message: Correct a comment To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/arch/mips/mips/mipsX_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/mipsX_subr.S diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.84 src/sys/arch/mips/mips/mipsX_subr.S:1.85 --- src/sys/arch/mips/mips/mipsX_subr.S:1.84 Mon Aug 8 10:21:34 2016 +++ src/sys/arch/mips/mips/mipsX_subr.S Tue Aug 9 08:56:23 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mipsX_subr.S,v 1.84 2016/08/08 10:21:34 skrll Exp $ */ +/* $NetBSD: mipsX_subr.S,v 1.85 2016/08/09 08:56:23 skrll Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -2728,7 +2728,7 @@ LEAF_NOPROFILE(MIPSX(cpu_switch_resume)) blt v0, t0, MIPSX(resume) nop #else - li t0, MIPS_KSEG0_START # above XKSEG? + li t0, MIPS_KSEG0_START # below KSEG0? blt t0, v0, MIPSX(resume) nop li t0, VM_MIN_KERNEL_ADDRESS>>32 # below XKSEG?
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Tue Aug 9 08:56:23 UTC 2016 Modified Files: src/sys/arch/mips/mips: mipsX_subr.S Log Message: Correct a comment To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/arch/mips/mips/mipsX_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 07:15:35 UTC 2016 Modified Files: src/sys/ufs/ext2fs: Makefile ext2fs_extents.h ext2fs_extern.h ext2fs_htree.c Log Message: More htree writing support (Hrishikesh Goyal GSoC 2016) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ext2fs/Makefile \ src/sys/ufs/ext2fs/ext2fs_extents.h cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 07:15:35 UTC 2016 Modified Files: src/sys/ufs/ext2fs: Makefile ext2fs_extents.h ext2fs_extern.h ext2fs_htree.c Log Message: More htree writing support (Hrishikesh Goyal GSoC 2016) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ext2fs/Makefile \ src/sys/ufs/ext2fs/ext2fs_extents.h cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/ext2fs/ext2fs_extern.h cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ext2fs/ext2fs_htree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/Makefile diff -u src/sys/ufs/ext2fs/Makefile:1.2 src/sys/ufs/ext2fs/Makefile:1.3 --- src/sys/ufs/ext2fs/Makefile:1.2 Fri Jun 3 17:55:50 2016 +++ src/sys/ufs/ext2fs/Makefile Tue Aug 9 03:15:35 2016 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.2 2016/06/03 21:55:50 joerg Exp $ +# $NetBSD: Makefile,v 1.3 2016/08/09 07:15:35 christos Exp $ INCSDIR= /usr/include/ufs/ext2fs -INCS= ext2fs.h ext2fs_dinode.h ext2fs_dir.h ext2fs_extents.h ext2fs_extern.h +INCS= ext2fs.h ext2fs_dinode.h ext2fs_dir.h ext2fs_extern.h .include Index: src/sys/ufs/ext2fs/ext2fs_extents.h diff -u src/sys/ufs/ext2fs/ext2fs_extents.h:1.2 src/sys/ufs/ext2fs/ext2fs_extents.h:1.3 --- src/sys/ufs/ext2fs/ext2fs_extents.h:1.2 Fri Jun 10 02:30:58 2016 +++ src/sys/ufs/ext2fs/ext2fs_extents.h Tue Aug 9 03:15:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extents.h,v 1.2 2016/06/10 06:30:58 dholland Exp $ */ +/* $NetBSD: ext2fs_extents.h,v 1.3 2016/08/09 07:15:35 christos Exp $ */ /*- * Copyright (c) 2012, 2010 Zheng Liu@@ -32,10 +32,6 @@ #define _UFS_EXT2FS_EXT2FS_EXTENTS_H_ #include -#ifndef _KERNEL -#include -#endif - #include #define EXT4_EXT_MAGIC 0xf30a Index: src/sys/ufs/ext2fs/ext2fs_extern.h diff -u src/sys/ufs/ext2fs/ext2fs_extern.h:1.49 src/sys/ufs/ext2fs/ext2fs_extern.h:1.50 --- src/sys/ufs/ext2fs/ext2fs_extern.h:1.49 Fri Jun 24 13:21:30 2016 +++ src/sys/ufs/ext2fs/ext2fs_extern.h Tue Aug 9 03:15:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extern.h,v 1.49 2016/06/24 17:21:30 christos Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.50 2016/08/09 07:15:35 christos Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -79,6 +79,7 @@ struct mbuf; struct componentname; struct ufs_lookup_results; struct ext2fs_searchslot; +struct ext2fs_direct; extern struct pool ext2fs_inode_pool; /* memory pool for inodes */ extern struct pool ext2fs_dinode_pool; /* memory pool for dinodes */ @@ -132,6 +133,8 @@ int ext2fs_dirremove(struct vnode *, con int ext2fs_dirrewrite(struct inode *, const struct ufs_lookup_results *, struct inode *, struct componentname *); int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t); +int ext2fs_add_entry(struct vnode *, struct ext2fs_direct *, +const struct ufs_lookup_results *); /* ext2fs_subr.c */ int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **); @@ -184,6 +187,10 @@ int ext2fs_htree_hash(const char *, int, int ext2fs_htree_has_idx(struct inode *); int ext2fs_htree_lookup(struct inode *, const char *, int, struct buf **, int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); +int ext2fs_htree_create_index(struct vnode *, struct componentname *, +struct ext2fs_direct *); +int ext2fs_htree_add_entry(struct vnode *, struct ext2fs_direct *, +struct componentname *); __END_DECLS Index: src/sys/ufs/ext2fs/ext2fs_htree.c diff -u src/sys/ufs/ext2fs/ext2fs_htree.c:1.1 src/sys/ufs/ext2fs/ext2fs_htree.c:1.2 --- src/sys/ufs/ext2fs/ext2fs_htree.c:1.1 Fri Jun 24 13:21:30 2016 +++ src/sys/ufs/ext2fs/ext2fs_htree.c Tue Aug 9 03:15:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_htree.c,v 1.1 2016/06/24 17:21:30 christos Exp $ */ +/* $NetBSD: ext2fs_htree.c,v 1.2 2016/08/09 07:15:35 christos Exp $ */ /*- * Copyright (c) 2010, 2012 Zheng Liu @@ -26,10 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/fs/ext2fs/ext2_htree.c 294653 2016-01-24 02:41:49Z pfg $ + * $FreeBSD: head/sys/fs/ext2fs/ext2fs_htree.c 294653 2016-01-24 02:41:49Z pfg $ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.1 2016/06/24 17:21:30 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.2 2016/08/09 07:15:35 christos Exp $"); #include #include @@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include #include - +#include #include #include @@ -59,9 +59,13 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_htree #include #include +static int ext2fs_htree_find_leaf(struct inode *, const char *, int , +uint32_t *, uint8_t *, struct ext2fs_htree_lookup_info *); + int ext2fs_htree_has_idx(struct inode *ip) { + /* XXX ip->i_flags should have got checked here for IN_E3INDEX */ return EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs,
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 06:40:25 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extents.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ext2fs/ext2fs_extents.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ext2fs
Module Name:src Committed By: christos Date: Tue Aug 9 06:40:25 UTC 2016 Modified Files: src/sys/ufs/ext2fs: ext2fs_extents.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ext2fs/ext2fs_extents.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ext2fs/ext2fs_extents.c diff -u src/sys/ufs/ext2fs/ext2fs_extents.c:1.1 src/sys/ufs/ext2fs/ext2fs_extents.c:1.2 --- src/sys/ufs/ext2fs/ext2fs_extents.c:1.1 Fri Jun 3 11:35:48 2016 +++ src/sys/ufs/ext2fs/ext2fs_extents.c Tue Aug 9 02:40:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extents.c,v 1.1 2016/06/03 15:35:48 christos Exp $ */ +/* $NetBSD: ext2fs_extents.c,v 1.2 2016/08/09 06:40:24 christos Exp $ */ /*- * Copyright (c) 2010 Zheng Liu@@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_extents.c,v 1.1 2016/06/03 15:35:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_extents.c,v 1.2 2016/08/09 06:40:24 christos Exp $"); #include #include @@ -80,13 +80,13 @@ ext4_ext_binsearch_index(struct inode *i path->ep_sparse_ext.e_start_hi = 0; path->ep_sparse_ext.e_start_lo = 0; path->ep_is_sparse = true; - return (true); + return true; } path->ep_index = l - 1; *first_lbn = path->ep_index->ei_blk; if (path->ep_index < last) *last_lbn = l->ei_blk - 1; - return (false); + return false; } static void @@ -156,7 +156,7 @@ ext4_ext_in_cache(struct inode *ip, dadd ep->e_len = ecp->ec_len; ret = ecp->ec_type; } - return (ret); + return ret; } /* @@ -189,7 +189,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs ehp = (struct ext4_extent_header *)ip->i_din.e2fs_din->e2di_blocks; if (ehp->eh_magic != EXT4_EXT_MAGIC) - return (NULL); + return NULL; path->ep_header = ehp; @@ -201,7 +201,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs path->ep_ext = NULL; if (ext4_ext_binsearch_index(ip, path, lbn, _lbn, _lbn)) { - return (path); + return path; } nblk = (daddr_t)path->ep_index->ei_leaf_hi << 32 | @@ -216,7 +216,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs if (error) { brelse(path->ep_bp, 0); path->ep_bp = NULL; - return (NULL); + return NULL; } ehp = (struct ext4_extent_header *)path->ep_bp->b_data; path->ep_header = ehp; @@ -228,5 +228,5 @@ ext4_ext_find_extent(struct m_ext2fs *fs path->ep_is_sparse = false; ext4_ext_binsearch(ip, path, lbn, first_lbn, last_lbn); - return (path); + return path; }