This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new c8b39b4 z20x: w25boot configuration nees CONFIG_FS_WRITABLE c8b39b4 is described below commit c8b39b48bbacd8b8468c82edc2ce5ac1987ad1a7 Author: Gregory Nutt <gn...@nuttx.org> AuthorDate: Sat Mar 7 16:56:32 2020 -0300 z20x: w25boot configuration nees CONFIG_FS_WRITABLE boards/z80/ez80/z20x/configs/w25boot/defconfig: needs CONFIG_FS_WRITABLE=y Style cleanup / Correct file header drivers/bch/bchdev_register.c, drivers/mtd/ftl.c, and fs/driver/fs_findblockdriver.c: Run through nxstyle; replace BSD-3 license with Apache 2.0 --- boards/z80/ez80/z20x/configs/w25boot/defconfig | 1 + drivers/bch/bchdev_register.c | 42 ++++------ drivers/mtd/ftl.c | 101 ++++++++++++------------- fs/driver/fs_findblockdriver.c | 41 ++++------ 4 files changed, 79 insertions(+), 106 deletions(-) diff --git a/boards/z80/ez80/z20x/configs/w25boot/defconfig b/boards/z80/ez80/z20x/configs/w25boot/defconfig index e1a96be..80b4f03 100644 --- a/boards/z80/ez80/z20x/configs/w25boot/defconfig +++ b/boards/z80/ez80/z20x/configs/w25boot/defconfig @@ -17,6 +17,7 @@ CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_DISABLE_MQUEUE=y CONFIG_EZ80_SPI=y CONFIG_EZ80_UART1=y +CONFIG_FS_WRITABLE=y CONFIG_HOST_WINDOWS=y CONFIG_MAX_TASKS=8 CONFIG_MAX_WDOGPARMS=2 diff --git a/drivers/bch/bchdev_register.c b/drivers/bch/bchdev_register.c index b199dd4..400c3a4 100644 --- a/drivers/bch/bchdev_register.c +++ b/drivers/bch/bchdev_register.c @@ -1,35 +1,20 @@ /**************************************************************************** * drivers/bch/bchdev_register.c * - * Copyright (C) 2008-2009, 2012, 2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gn...@nuttx.org> + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -68,6 +53,9 @@ int bchdev_register(FAR const char *blkdev, FAR const char *chardev, FAR void *handle; int ret; + finfo("blkdev=\"%s\" chardev=\"%s\" readonly=%c\n", + blkdev, chardev, readonly ? 'T' : 'F'); + /* Setup the BCH lib functions */ ret = bchlib_setup(blkdev, readonly, &handle); diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index c1df2e7..eb1b37b 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -1,36 +1,20 @@ /**************************************************************************** * drivers/mtd/ftl.c * - * Copyright (C) 2009, 2011-2012, 2016, 2018 Gregory Nutt. All rights - * reserved. - * Author: Gregory Nutt <gn...@nuttx.org> + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -79,16 +63,16 @@ struct ftl_struct_s { - FAR struct mtd_dev_s *mtd; /* Contained MTD interface */ - struct mtd_geometry_s geo; /* Device geometry */ + FAR struct mtd_dev_s *mtd; /* Contained MTD interface */ + struct mtd_geometry_s geo; /* Device geometry */ #ifdef FTL_HAVE_RWBUFFER - struct rwbuffer_s rwb; /* Read-ahead/write buffer support */ + struct rwbuffer_s rwb; /* Read-ahead/write buffer support */ #endif - uint16_t blkper; /* R/W blocks per erase block */ - uint16_t refs; /* Number of references */ - bool unlinked;/* The driver has been unlinked */ + uint16_t blkper; /* R/W blocks per erase block */ + uint16_t refs; /* Number of references */ + bool unlinked; /* The driver has been unlinked */ #ifdef CONFIG_FS_WRITABLE - FAR uint8_t *eblock; /* One, in-memory erase block */ + FAR uint8_t *eblock; /* One, in-memory erase block */ #endif }; @@ -100,16 +84,19 @@ static int ftl_open(FAR struct inode *inode); static int ftl_close(FAR struct inode *inode); static ssize_t ftl_reload(FAR void *priv, FAR uint8_t *buffer, off_t startblock, size_t nblocks); -static ssize_t ftl_read(FAR struct inode *inode, unsigned char *buffer, +static ssize_t ftl_read(FAR struct inode *inode, FAR unsigned char *buffer, size_t start_sector, unsigned int nsectors); #ifdef CONFIG_FS_WRITABLE static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, off_t startblock, size_t nblocks); -static ssize_t ftl_write(FAR struct inode *inode, const unsigned char *buffer, - size_t start_sector, unsigned int nsectors); +static ssize_t ftl_write(FAR struct inode *inode, + FAR const unsigned char *buffer, size_t start_sector, + unsigned int nsectors); #endif -static int ftl_geometry(FAR struct inode *inode, struct geometry *geometry); -static int ftl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg); +static int ftl_geometry(FAR struct inode *inode, + FAR struct geometry *geometry); +static int ftl_ioctl(FAR struct inode *inode, int cmd, + unsigned long arg); #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS static int ftl_unlink(FAR struct inode *inode); #endif @@ -186,6 +173,7 @@ static int ftl_close(FAR struct inode *inode) kmm_free(dev->eblock); } #endif + kmm_free(dev); } @@ -253,12 +241,12 @@ static int ftl_alloc_eblock(FAR struct ftl_struct_s *dev) { if (dev->eblock == NULL) { - /* Allocate one, in-memory erase block buffer */ + /* Allocate one, in-memory erase block buffer */ - dev->eblock = (FAR uint8_t *)kmm_malloc(dev->geo.erasesize); + dev->eblock = (FAR uint8_t *)kmm_malloc(dev->geo.erasesize); } - return dev->eblock != NULL ? OK : -ENOMEM; + return dev->eblock != NULL ? OK : -ENOMEM; } static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, @@ -382,7 +370,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, nxfrd = MTD_BWRITE(dev->mtd, alignedblock, dev->blkper, buffer); if (nxfrd != dev->blkper) { - ferr("ERROR: Write erase block %d failed: %d\n", alignedblock, nxfrd); + ferr("ERROR: Write erase block %d failed: %d\n", + alignedblock, nxfrd); return -EIO; } @@ -409,7 +398,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, nxfrd = MTD_BREAD(dev->mtd, alignedblock, dev->blkper, dev->eblock); if (nxfrd != dev->blkper) { - ferr("ERROR: Read erase block %d failed: %d\n", alignedblock, nxfrd); + ferr("ERROR: Read erase block %d failed: %d\n", + alignedblock, nxfrd); return -EIO; } @@ -435,7 +425,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, nxfrd = MTD_BWRITE(dev->mtd, alignedblock, dev->blkper, dev->eblock); if (nxfrd != dev->blkper) { - ferr("ERROR: Write erase block %d failed: %d\n", alignedblock, nxfrd); + ferr("ERROR: Write erase block %d failed: %d\n", + alignedblock, nxfrd); return -EIO; } } @@ -452,8 +443,9 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, ****************************************************************************/ #ifdef CONFIG_FS_WRITABLE -static ssize_t ftl_write(FAR struct inode *inode, const unsigned char *buffer, - size_t start_sector, unsigned int nsectors) +static ssize_t ftl_write(FAR struct inode *inode, + FAR const unsigned char *buffer, + size_t start_sector, unsigned int nsectors) { struct ftl_struct_s *dev; @@ -476,9 +468,10 @@ static ssize_t ftl_write(FAR struct inode *inode, const unsigned char *buffer, * ****************************************************************************/ -static int ftl_geometry(FAR struct inode *inode, struct geometry *geometry) +static int ftl_geometry(FAR struct inode *inode, + FAR struct geometry *geometry) { - struct ftl_struct_s *dev; + FAR struct ftl_struct_s *dev; finfo("Entry\n"); @@ -596,6 +589,7 @@ static int ftl_unlink(FAR struct inode *inode) kmm_free(dev->eblock); } #endif + kmm_free(dev); } @@ -631,9 +625,11 @@ int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd) return -EINVAL; } + finfo("path=\"%s\"\n", path); + /* Allocate a FTL device structure */ - dev = (struct ftl_struct_s *)kmm_zalloc(sizeof(struct ftl_struct_s)); + dev = (FAR struct ftl_struct_s *)kmm_zalloc(sizeof(struct ftl_struct_s)); if (dev) { /* Initialize the FTL device structure */ @@ -645,7 +641,8 @@ int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd) * from the size of a pointer). */ - ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&dev->geo)); + ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, + (unsigned long)((uintptr_t)&dev->geo)); if (ret < 0) { ferr("ERROR: MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); diff --git a/fs/driver/fs_findblockdriver.c b/fs/driver/fs_findblockdriver.c index bb0aab3..4e87cf9 100644 --- a/fs/driver/fs_findblockdriver.c +++ b/fs/driver/fs_findblockdriver.c @@ -1,35 +1,20 @@ /**************************************************************************** * fs/driver/fs_findblockdriver.c * - * Copyright (C) 2008, 2017 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gn...@nuttx.org> + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in pathname and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of pathname code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -86,6 +71,8 @@ int find_blockdriver(FAR const char *pathname, int mountflags, DEBUGASSERT(pathname != NULL || ppinode != NULL); + finfo("pathname=\"%s\"\n", pathname); + /* Find the inode registered with this pathname */ SETUP_SEARCH(&desc, pathname, false);