[U-Boot] [PATCH v5 0/20] Add environment call-back and flags capability

Joe Hershberger joe.hershberger at ni.com
Wed Dec 12 05:16:17 CET 2012


When a variable with a registered callback is inserted, deleted, or
overwritten the callback is called and gives the system an opportunity
to do something in response to the change.  It also has the opportunuty
to reject the change by returning non-zero.

The flags on variables can control their type as well as their allowed
access.

        The format of the list is:
                type_attribute = [s|d|x|b|i|m]
                attributes = type_attribute
                entry = variable_name[:attributes]
                list = entry[,list]

        The type attributes are:
                s - String (default)
                d - Decimal
                x - Hexadecimal
                b - Boolean ([1yYtT|0nNfF])
                i - IP address
                m - MAC address

        The access attributes are:
                a - Any (default)
                r - Read-only
                o - Write-once
                c - Change-default

Changes in v5:
- Manually relocate change_ok() pointer
- Add support for CONFIG_NEEDS_MANUAL_RELOC boards
- Fixed comment typo
- Fixed callbacks command help
- Compare current callback against pre-relocation address manually
- Fixed out-of-bounds array access in env_flags_parse_vartype()
- Fixed out-of-bounds array access in env_flags_parse_varaccess()

Changes in v4:
- Prevent crash on relocation import
- Fixed help text
- Add help text for env flags command
- Add force support to setenv
- Implement delete

Changes in v3:
- Rebase onto Gerlando Falauto's env patches
- Refactor himport_r() and hsearch_r()'s parameters
- Split hdelete_r() into the core delete and the validation before
delete
- Delete vars on failed insertion
- Use Marek's linker lists instead of implementing it directly
- Rebase onto latest master
- Add flags parameter to callbacks
- Implement reverse search in env_attr_lookup()
- Fix space skipping in env_attr_lookup()
- All errors coming back from hsearch_r() are no longer fatal.  Don't
abort import on failed ENTER action.
- Removed checkpatch.pl warning

Changes in v2:
- Added much-needed documentation
- Factored out prevch and nextch in env_attr_lookup()

Joe Hershberger (20):
  Make linux kernel string funcs available to tools
  env: Refactor do_apply to a flag
  env: Consolidate common code in hsearch_r()
  env: Refactor apply into change_ok
  env: Use getenv_yesno() more generally
  env: Hide '.' variables in env print by default
  env: Add support for callbacks to environment vars
  env: Add a command to view callbacks
  env: Add a bootfile env handler
  env: Add a baudrate env handler
  env: Add a loadaddr env handler
  env: Add a console env handler
  env: Add a silent env handler
  env: Add environment variable flags
  tools/env: Add environment variable flags support
  env: Add a command to display details about env flags
  env: Add support for access control to .flags
  env: Add setenv force support
  env: Implement the env delete command
  env: Handle write-once ethaddr and serial# generically

 README                          |  80 ++++++
 arch/arm/lib/board.c            |   4 +-
 arch/m68k/lib/board.c           |   3 +-
 arch/microblaze/lib/board.c     |   4 +-
 arch/powerpc/cpu/mpc85xx/mp.c   |   4 +-
 arch/powerpc/lib/board.c        |   9 +-
 arch/sparc/lib/board.c          |   3 +-
 board/Marvell/db64360/db64360.c |  10 +-
 board/Marvell/db64460/db64460.c |  10 +-
 board/esd/cpci750/cpci750.c     |  10 +-
 board/esd/pmc440/cmd_pmc440.c   |   2 +-
 board/gw8260/gw8260.c           |  10 +-
 board/prodrive/p3mx/p3mx.c      |  10 +-
 common/Makefile                 |   6 +
 common/cmd_nvedit.c             | 406 +++++++++++++++++------------
 common/console.c                |  75 +++++-
 common/env_attr.c               | 229 ++++++++++++++++
 common/env_callback.c           | 144 +++++++++++
 common/env_common.c             |  61 +++--
 common/env_dataflash.c          |   2 +-
 common/env_eeprom.c             |   2 +-
 common/env_fat.c                |   2 +-
 common/env_flags.c              | 560 ++++++++++++++++++++++++++++++++++++++++
 common/env_flash.c              |   4 +-
 common/env_mmc.c                |   2 +-
 common/env_nand.c               |   4 +-
 common/env_nvram.c              |   2 +-
 common/env_onenand.c            |   2 +-
 common/env_sf.c                 |   4 +-
 common/image.c                  |  21 +-
 doc/README.silent               |  14 +-
 drivers/serial/serial.c         |  70 +++++
 include/common.h                |   5 +
 include/env_attr.h              |  55 ++++
 include/env_callback.h          |  75 ++++++
 include/env_default.h           |   8 +
 include/env_flags.h             | 172 ++++++++++++
 include/environment.h           |  15 +-
 include/image.h                 |   1 -
 include/linux/linux_string.h    |   8 +
 include/linux/string.h          |   5 +-
 include/search.h                |  37 ++-
 lib/Makefile                    |   1 +
 lib/hashtable.c                 | 244 +++++++++++------
 lib/linux_string.c              |  51 ++++
 lib/string.c                    |  39 ---
 net/net.c                       |  49 ++--
 tools/env/Makefile              |   3 +
 tools/env/fw_env.c              |  92 +++++--
 49 files changed, 2182 insertions(+), 447 deletions(-)
 create mode 100644 common/env_attr.c
 create mode 100644 common/env_callback.c
 create mode 100644 common/env_flags.c
 create mode 100644 include/env_attr.h
 create mode 100644 include/env_callback.h
 create mode 100644 include/env_flags.h
 create mode 100644 include/linux/linux_string.h
 create mode 100644 lib/linux_string.c

-- 
1.7.11.5



More information about the U-Boot mailing list