9
0
Fork 0
Commit Graph

34 Commits

Author SHA1 Message Date
Renaud Barbier ad43a6de3d ubifs: restore symlink support
In commit a63059d7 of the latest u-boot port, the function that
returns the inode number also resolves symlink. This prevents the
readlink entry point from doing its job and breaks the user command
readlink and the display of symlink with the ls command.
Remove the code following the link to restore original functionality.

Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-09 13:41:12 +01:00
Lucas Stach 01cbfdfb3f ubifs: check return pointer properly
ubifs_iget() returns error codes encoded in the pointer,
so the NULL check will never be true.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:45:35 +02:00
Sascha Hauer 4cb8e17aa3 Merge branch 'for-next/misc' 2016-05-09 08:49:43 +02:00
Du Huanpeng fe03b34fbe whole tree: remove trailing whitespaces
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-21 15:17:52 +02:00
Sascha Hauer 947fb5adf8 string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:45 +02:00
Sascha Hauer db33f32842 include: move crc specific stuff to crc.h
We have a crc.h, so move our crc function prototypes there to further
cleanup common.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:44 +02:00
Alexander Stein a63059d753 ubifs: update implementation from u-boot v2016.03
This updated code supports recovering from unclean unmounts when write
buffer size is larger than 8. Linux uses takes information into
consideration when checking for writes.
The following list shows the changes for each file done compared to
u-boot v2016.03 code.

Makefile
* Add gc.o, do not include header as in u-boot

budget.c:
* Replace __UBOOT__ with __BAREBOX__

debug.c:
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Replace current->pid with 0

debug.h
* Replace __UBOOT__ with __BAREBOX__
* Add "0 &&" to ubifs_assert condition check
  U-Boot essentially disabled pr_crit output and dump_stack() is defined
  to do { } while (0), so ubifs_assert does nothing despite condition.

gc.c:
* Replace __UBOOT__ with __BAREBOX__

io.c:
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

key.h:
* No changes

log.c:
* No changes

lprops.c:
* Replace __UBOOT__ with __BAREBOX__

lpt.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>

lpt_commit.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

master.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>

misc.h
* Replace __UBOOT__ with __BAREBOX__
* Add #ifndef __BAREBOX__ around unneeded ubifs_current_time

orphan.c
* No changes

recovery.c
* Replace __UBOOT__ with __BAREBOX__

replay.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

sb.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>
* Remove #include <ubi_uboot.h>
* rp_uid and rp_gid are still uid_t, not kuid_t, so remove .val

scan.c
* Replace __UBOOT__ with __BAREBOX__

super.c:
* Replaced current->pid with 0
* Replaced __UBOOT__ with __BAREBOX__
* Removed #include <ubi_uboot.h>
* Removed #include <memalign.h>
* Added #include <init.h>
* Replaced malloc_cache_aligned with kzalloc
* Replaced I_LOCK with I_SYNC
* i_uid and i_gid are still uid_t, not kuid_t, so remove .val
* Replaced string "U-Boot" with "Barebox"
* Add #ifndef __BAREBOX__ around open_ubi, sb_test, sb_set, ubifs_mount,
  kill_ubifs_super, ubifs_fs_type
* Do not call ubi_open_volume or ubi_close_volume in ubifs_fill_super
  Those will already be handled in ubifs_probe
* Replaced uboot_ubifs_mount with new ubifs_get_super implementation using
  existing functions alloc_super, alloc_ubifs_info

tnc.c
* Replace __UBOOT__ with __BAREBOX__
* Remove #include <linux/compat.h>

tnc_misc.c
* Replace __UBOOT__ with __BAREBOX__

ubifs-media.h
* Replace __UBOOT__ with __BAREBOX__

ubifs.c:
* Replaced __UBOOT__ with __BAREBOX__
* Adjusted header includes
* Removed DECLARE_GLOBAL_DATA_PTR
* Add static struct z_stream_s variable
* Add struct ubifs_priv delcaration
* Replaced zunzip with deflate_decompress call
* Add ifdef for disabling ZLIB and/or LZO support
* Replaced malloc_cache_aligned with kzalloc
* Added #ifndef __BAREBOX__ around filldir, ubifs_printdir,
  ubifs_set_blk_dev, ubifs_ls, ubifs_exists, ubifs_size, do_readpage,
  ubifs_read, ubifs_close, ubifs_load
* Make parameter filename const char* in ubifs_findfile
* Add UBIFS fs_driver_d implementation
* Add zlib_decomp_init, ubifs_init

ubifs.h:
* Replaced __UBOOT__ with __BAREBOX__
* Adjusted header includes
* Added old #define crc32
* Added helper around kmem*
* Added XATTR_LIST_MAX define
* Added #ifndef __BAREBOX__ around current_fs_time struct inode,
  struct super_block, file_system_type, dentry and friends which barebox
  already has
* Added #ifndef __BAREBOX__ around write_inode in super_operations to avoid
  declaration of writeback_control
* Change rp_uid and rp_gid to uid_t and gui_t
* Added struct device_d to struct ubifs_info
* Added forward declaration of ubifs_get_super

linux/fs.h:
* Make struct inode's i_nlink a union containing a non-const int __i_nlink
  while making i_nlink a const int

linux/fs.h:
* Add s_remove_count

linux/fs.h:
* Convert struct super_block.s_instances and
  struct file_system_type.fs_supers to hlist_head

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-08 13:33:18 +02:00
Sascha Hauer 79606b51ed Merge branch 'for-next/linux-headers' 2016-02-08 08:26:36 +01:00
Sascha Hauer 6c57aca60d ubifs: Fix reading holes in files
When a whole block of 4KiB in an ubifs file is zero then the block is
not stored in the filesystem. read_block() returns -ENOENT in this case,
so this return value must be treated as success.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-04 12:22:41 +01:00
Yegor Yefremov 7814ae61ab Introduce include/linux/mutex.h
Move mutex related defines to its original place.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-03 07:57:32 +01:00
Yegor Yefremov baa7fe1d15 Introduce include/linux/spinlock.h
Move spinlock related definitions to its original place.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov 7a583dfb4f Introduce include/linux/sched.h
Move cond_resched() from barebox-wrapper.h to its original
place.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov 6f332972ef fs: ubifs: move file and file_system_type definitions to linux/fs.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov d20f839037 fs: ubifs: move path definition to include/linux/path.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov 3243c0d236 fs: ubifs: move vfsmount definition to include/linux/mount.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov b456308c4c fs: ubifs: move dcache related definitions to include/linux/dcache.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov 838ca724e7 fs: move pgoff_t definition to include/linux/types.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov 00dd903055 fs: use linux/fs.h for file system related definitions
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-01 09:16:13 +01:00
Yegor Yefremov e5bd17b896 fs: ubifs: remove redundant macro defines
Remove macros, that were already defined in linux/stat.h.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-29 08:04:27 +01:00
Yegor Yefremov 3b4740b2c1 fs: move PAGE_CACHE definitions to include/linux/pagemap.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-29 08:04:27 +01:00
Yegor Yefremov 489c8ba906 fs: introduce include/linux/fs.h
Move Linux file system structs from UBIFS to central place.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-29 08:04:06 +01:00
Yegor Yefremov fa75e4ea25 fs: move struct timespec to include/linux/time.h
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-29 08:04:00 +01:00
Sascha Hauer 7e44c8495a introduce strerrorp
putting an error pointer into strerror can be a bit confusing since
strerror takes a positive error code but PTR_ERR returns a negative
number, so we have to do strerror(-PTR_ERR(errp)). Some places got
this wrong already, so introduce a strerrorp function which directly
takes an error pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 17:12:44 +02:00
Sascha Hauer 745594d51a fs: ubifs: Implement Linux rootarg
Add the parameter to boot from ubifs fileystems. This assumes that
there will be only one UBI device registered in the kernel, otherwise
there is no way to predict the ubi number.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer 6977292a34 fs: rename inode member of struct filep to priv
Because that's what it is. 'inode' will become confusing
once we support real inodes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-09 08:06:41 +01:00
Masahiro Yamada 150cf52a3e fs: ubifs: remove redundant macro defines
fs/ubifs/ubifs.h includes <common.h> and the macros INT_MAX, INT_MIN,
LLONG_MAX are already defined there.

The same defines in fs/ubifs/ubifs.h are redundant.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:58:07 +01:00
Alexander Shiyan 6b5a16f193 ubifs: Remove unused variable
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 14:00:25 +02:00
Sascha Hauer 6dac289d0c fs: ubifs: rework logging
By default UBIFS is very verbose. Decrease the verbosity, turn
printf messages into ubifs_ messages and add device parameters
for the values which are not printed anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:24:05 +01:00
Sascha Hauer 15d559e191 fs: ubifs: Fix unused function warning
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:23:01 +01:00
Renaud Barbier 4a6c8b1e04 UBIFS: implement readlink entry point
Implement the readlink entry point for future use by the DA923RC.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-30 08:42:53 +01:00
Sascha Hauer 278850a442 fs ubifs: Use pr_* for printing messages
Unline the printk(KERN_* the pr_* functions cooperate with the
barebox loglevel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-16 14:29:41 +01:00
Alexander Shiyan cf9b0c6927 ubifs: Remove redundant assignment
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 08:51:44 +02:00
Sascha Hauer ecb3aaa23b fs: cleanup backingstore handling
All filesystem drivers which need a backingstore device do the same
ignoring of '/dev/' in the backingstore followed by a cdev_open. Add a
helper function for it and let the core handle the cdev. As a side
effect this makes sure that fsdev->cdev is also set when a device is
mounted without the leading '/dev/' which was previously ignored
by the mount code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:11:14 +02:00
Sascha Hauer 551b412b16 fs: Add ubifs support
This adds ubifs support from u-boot-2013.07. This is taken
mostly as-is, only the necessary adjustments to attach to the
barebox fs layer have been made.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00