Add README.new_api

This is the documentation of the new api and the status of the new
api work.  It will eventually move somewhere else...

Signed-off-by: Jim Lieb <jlieb@panasas.com>
New fsal API infrastructure

* Add new file fsal_api.h

  This defines the public fsal call and object api.
  api linkage for fsal_manager and new fsal api
  Taking (almost) final form.  All methods are at least complete.

* Add new file FSAL/fsal_init.h

  Part of the new api used for module initialization
  and configuration

* Add fsal_manager.c

  Core of new fsal module handling
  - server init functions to load/unload modules
  - lookup function to return a fsal handle which can be used for
    creating other fsal related objects.
  - module registration that works for both static and dynamic modules

* Add new filefsal_commonlib.c

  This file and its header contain to types of common functions:

  - functions that operate on the common/public portions of
    objects.
  - fsal object methods of the same constraint.

* Add fsal_config.c

  Initialize fsal parameter control data structures.
  - Set defaults.
  - Set values from parsed config file
  - fs info access handlers
  - Add dir_has_sticky_bit support

* Add test_access method to access_check.c

  Uses struct user_creds in place of fsal_op_context_t.  Rework
  access checking to use user_creds.  Old fsal_access_check function
  still in place.

  To meet the GPFS requirement for switchable access checking,
  test_access is a default common method.  A fsal that wants to
  do its own replaces this in its handle 'test_access' method.

* back out hpss ifdefs skeleton fsal_check_access for clean
  compiles of old fsal code.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update fsal_types to new api

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Rework server initialization to use new FSAL infrastructure

* Replace fsal_op_context with user_cred

* Make config_struct an extern so we can reference the config parse once

* nfs_set_param_from_conf proto to add config_struct as arg

* Update nfs_init.c

  Remove old fsal config and init from nfs_init.c
  This is no longer needed in new api.
  Move config parse to nfs_main where it is done right after
  options parsing.

* Update nfs_main.c

  Parse moved from nfs_init.c to here so it happens right after
  options parsing.  Start fsal modules so detected in the config.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Support new FSAL infrastructure in exports managment

Update nfs_export_list.c to new api

New api changes to struct exportlist__
* Deprecate fsalid and replace with export_hdl from new api.
* proot_handle changes to new object handle type.

These changes ripple through lots of code, breaking things
because these are fundamental, used all over the place data
types. fsal_handle_t which is structure copied everywhere becomes
a pointer to struct fsal_obj_object...

Remove nfs_build_fsal_context because the function is gone
pcontext is replaced by creds in compound_data

Update support/nfs_client_id.c for new api

deprecate CleanUpExportContext.  Add release of export
to RemoveExportEntry

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Move handle management to use handle objects

Replace fsal_handle_t with struct fsal_obj_handle in call frame

To make this work, we need to make use of the exportid which
we decode from the on-the-wire handle.  This first switches us
to the appropriate export (and its export object).  From that,
we can decode a FSAL appropriate handle.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change cache_inode.h to use new api

fsal_handle_t is deprecated for fsal_obj_handle.

restructure cache_entry_t
* attributes moves to fsal_obj_handle public part
* symlink moves to fsal_obj_handle private part
* function prototypes around cache_inode_new_entry change

adjust function prototypes
* function protos shift from op_context to creds
* replace fsal_op_context with user creds

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Move hash functions from FSAL layer to cache_inode_fsal_hash.c

* Remove FSAL_Handle_to_Hash_both from cache_inode_fsal_hash.c

  This was implemented in fsal_glue.c and in none of the actual fsals.
  This deprecates it from the old api.  There is no equivalent in the
  new api.

* Change declarations and calls to new api.

* Move the VFS hash functions here.  Added a note on how to implement
  other hash functions at a later time.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change Cache_inode lookup and create functions to new api

The big change here is we are passing pointers to the object handles
and dealing with objects rather than opaque members of cache_entry_t.

Remove fsal_op_context everywhere and use user creds instead.  This may
evolve further to pass more transaction context but the link between a
thread stack var and cache inode processing is broken.

* cache_inode_misc.c
  Update new entry to use fsal object handles.  Remove initial HashTableGet
  as it was already done just before we got here.  Some attribute cleanup

* Change cache_inode_get.c to new api
  call to readlink and get attributes removed.  This is now done in the
  fsal methods.

  A lot gets simplified now that the fsal fills out attributes and symlinks
  at lookup/create_handle time.

* Change cache_inode_lookupp.c to use new api

  Pass struct user_cred instead of fsal_op_context

* Change cache_inode_lookup.c for new api

  Replace old api calls with new api
  pass struct user_cred instead of fsal_op_context.

  This is a good example of how the api changes.  This code
  previously assumed only one fsal...

  simplify with change of cache_inode_new_entry api

* Update Cache_inode/cache_inode_create to new api

  One change to the api is to use the object attributes to pass in
  the attributes to the create.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update Cache_inode/cache_inode_make_root.c

* remove fsal_op_context

* Now takes a fsal object handle

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change Cache_inode entry management functions to new api

* Change cache_inode_renew_entry.c to new api

  remove fsal_op_context as well

  remove symlink and attribute descriptor

* Update Cache_inode/cache_inode_kill_entry.c to new api

  Change types on handle declarations in cache_inode_kill_entry.c

  Also add call to release the handle.  This is a significant difference
  from the old api.  Old handles were defined structures within the
  cache inode entry and had no linkage/affinity to a fsal.  This  was
  fine if one assumed only one fsal.  The release reflects the cleanup
  of allocations required.  There may be more paths to this.  The
  potential is object handle leaks...

* Update Cache_inode/cache_inode_invalidate.c to new api

  Use new function prototypes.
  The second change is a pointer copy rather than a structure copy
  of a large structure.  This is one of the stack space savers...

* Update Cache_inode/cache_inode_gc.c to new api

  Add release and change function protos in cache_inode_gc.c

  Declarations changed to new api.
  Add release method call on the handle.  This is no longer an
  element in the cache entry but allocated by the fsal.  There may
  be other paths that could leak object handles.

  removes symlink code (in fsal object now) and fileno as it disappears

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update Cache_inode/cache_inode_readdir.c to new api

Not quite done.  needs nonamecache path.
This doesn't compile yet.  must wait for final readdir fixes, rebase
and then fix populate and friends

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change Cache_inode attribute management to new api

* Change cache_inode_getattr.c to use new api

  Remove deprecated fsal_op_context

* Change cache_inode_access.c to use new api

  This first step removes the purpose of FSAL_access which first
  gets the attributes and then calls FSAL_test_access to do the access check.
  This brings the decision on whether to (re)fetch fresh attributes from
  the filesystem into the core.  This needs to be further refined
  by the upcall path which can/should/will invalidate stale
  attributes.  If the upcall marks the attributes as "stale" but does
  not do a getattrs method in the upcall, we can leave that overhead
  to the next access check, i.e. we would make it "lazy"...

  It gets passed struct user_cred instead of fsal_op_context
  This is the central access checker for cache inode.  This is the
  last stop for credentials checking.

  Handle method test_access is common for most fsals.  However, a fsal
  can choose to do its own.

* Change cache_inode_setattr.c to new api.

  Do access checks here, not in the FSAL anymore (unless it really wants to).

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change Cache_inode I/O operations to new api

* Update cache_inode_open_close.c for new api

* Update cache_inode_rdwr.c for new api

* Update cache_inode_commit.c for new api

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change Cache_inode file management to new api

* Change cache_inode_link.c to new api

  change handle type declarations

  Pass struct user_cred instead of fsal_op_context

* Change cache_inode_rename.c to use new api

  pass struct user_cred instead of fsal_op_context

* Change cache_inode_readlink.c to new api

* Update Cache_inode/cache_inode_remove.c for new api

  Change types of handles to new api.
  pass struct user_cred instead of fsal_op_context
  do access checks here instead of in fsal

* Update Cache_inode/cache_inode_truncate.c

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Change cache_inode_statfs.c to use new api

Remove fsal_op_context arg from cache_inode_statfs.c
also remove pstatus arg as it is redundant.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update file content management to new api

Update cache_content.h to new prototypes
* Remove unused fsal_op_context arguments mostly.

Update cache_content_misc.c to new api
* Remove op_context param from cache_content_misc.c because
  pcontext is not used.  Also change fsal handle to fsal object handle

Update File_Content/cache_content_flush.c for new api

Update cache_content_add_entry.c to remove uneeded fsal_op_context

Update cache_content_rdwr.c for new api

Update cache_content_flush.c for new api

Update cache_content_crash_recover.c for new api

Update cache_content_add_entry.c for new api

Update File_Content_Policy/cache_content_cache_behaviour.c for new api

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update state management to new api

Update include/sal_functions.h for new api
* Remove pcontext from function prototypes

Update SAL/state_lock.c for new api
* Remove pcontext usage and convert to new api calls

Update SAL/nfs4_state_id.c for new api

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update include/nfs_proto_functions.h,nfs_proto_tools.h for new api

deprecate fsal_op_context in favor of user_creds.
This is all it was anyway except for the struct copy size
and space limitations.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Update Protocols/NFS/nfs_proto_tools.c to new api merge

convert to use export fs_supports method.
remove usage of nfs_build_fsal_context

Signed-off-by: Jim Lieb <jlieb@panasas.com>