[Dev] Fwd: Fwd: Re: Regarding Multi-User architecture, https://bugs.tizen.org/jira/browse/PTREL-285

Stéphane Desneux stephane.desneux at open.eurogiciel.org
Thu Dec 26 19:10:49 GMT 2013


Hello Shiva,

Nice to see that your started to use the platform. We'll provide more 
documentation after Christmas break: a tutorial on how to convert the existing 
packages and which tricks to use for different situations is definitely needed.

In the meantime, please find the answers below.

Happy new year !

Stéphane

-- 
Stéphane Desneux
Intel OTC - Vannes/FR
gpg:1CA35726/DFA9B0232EF80493AF2891FA24E3A2841CA35726


SHIVAKUMAR JAGALUR MATT wrote:
> Dear  Stephane,
>
>          Thanks for the Information. We have used tizen-platform-wrapper apis in place of hardcode paths find in .c files in our Telephony package using "tizen" branch, I need few other information as below:
>
>          1) Do we need to Delete the variable returned from tizen-platform-wrapper apis,(i.e tzplatform_getname() etc.) OR No ?.

No. It was designed to replace the static strings in place without extra calls.

If for some reason, you need to clear the memory allocated by the library, you 
can call tzplatform_reset() but usually it's useless.

Also note that the pointer returned by tzplatform_getname() is readonly (the 
memory chunk is protected to avoid any mistake). That's why we added some helper 
functions as tzplatform_mkpath(): these funcs are thread safe and return a 
static buffer address per thread. Again, the memory is allocated per-thread and 
there's no need to free it: the buffer is reused from one call to another.

>          2) In our module .Spec files we are using chmod 664 and chmod 660, does these also need change ?.

Yes. Use rpm macros %TZ_SYS_XXXX instead of the initial path (see the macros 
file in /etc/rpm/macros.tizen-platform)
  	
>          3) In our module .Spec files we are using  DB path as /opt/dbspace/.dnet.db, so these we need to change by using tzplatform_mkpath(TZ_SYS_DB, ".dnet.db") api ?

In the spec file, no: use the rpm macros. (ex: %{TZ_SYS_DB}/.dnet.db)

Inside the source code, yes you can use tzplatform_mkpath(TZ_SYS_DB, ".dnet.db")

>          4) In our module .Spec files we are creating/accessing DB using sqlite3 command as "sqlite3 /opt/dbspace/.dnet.db<  /usr/share", so if no direct access to Tizen dbs is allowed, do we need to use any wrapper to access DB again OR
>              do we need to move these DB creation/accessing code to any init function calls in .C file of our modules ?.

The real question is: is the given db global or per-user. If it's global 
(shared, accessed by a single daemon not running as user etc.), you can still 
use sqlite3 from the spec file using the rpm macros to define the path:

sqlite3 %{TZ_SYS_DB}/.dnet.db <....

But if for any reason, the database is a per-user db, you need to move the init 
code somewhere else and call it at init time in your module (instead of 
post-install time in the spec file).

A simple solution would be to package an init script which can source the 
/etc/tizen-platform.conf to get all the definitions including user-specific ones 
and use them inside the script. This script can be called from source code if 
needed.
OR
Simply embed the necessary ops inside the source code if it's more appropriate.

> 		
>          5) In our module .conf files we are using<policy user="app">, so these we need to change by using tzplatform_getuid(TZ_USER_NAME) ?

I don't see precisely which conf file you're talking about.

If it's a global conf file, there's no sense to specify a user name: the policy 
should apply to all users.

If it's a per-user file, yes you'd have to generate it using TZ_USER_NAME (from 
a script sourcing /etc/tizen-platform.conf or source code with 
tzplatform_getname(TZ_USER_NAME) ).

> 	
>
> Thanks
> Shiva
>
> ------- Original Message -------
> Sender : Stéphane Desneux<stephane.desneux at open.eurogiciel.org>
> Date   : Dec 19, 2013 20:12 (GMT+09:00)
> Title  : Re: [Dev] Fwd: Fwd: Re: Regarding Multi-User architecture,
>   https://bugs.tizen.org/jira/browse/PTREL-285
>
> Shiva,
>
> I created a FAQ reflecting our recent discussion, hoping this will help
> the community.
>
> See: https://wiki.tizen.org/wiki/Multi-user_Architecture#FAQ
>
>
> Please find below the answers to your questions:
>
> 1) See
> https://wiki.tizen.org/wiki/Multi-user_Architecture#Is_there_a_tizen_3.0_branch_in_platform.2Fcore.2Fappfw.2Ftizen-platform-config_.3F
>
> Actually, I don't see much tizen_3.0 branches on repos. Do you have an
> example of such project where tizen_3.0 branch is already created ?
>
> 2) The pkgs are available.
>
> See:
> https://wiki.tizen.org/wiki/Multi-user_Architecture#Is_tizen-platform-config_available_.3F
>
> 3) I tried to summarize the different use cases we encounter.
>
> See:
> https://wiki.tizen.org/wiki/Multi-user_Architecture#tizen-platform-config_usage
>
> Using the tzplatform_xxx API is the good way to do things because it's
> simple, efficient and will be a good control point for future enhancements.
>
> Also note, that if you don't use the wrapper lib, you're on your own to
> parse the config file and evaluate variables: in particular, you can't
> count on the TZ_XXX variables to be present in the process environment
> and getenv() won't work in any situation.
>
>
> I push below the full FAQ for reference and web indexing.
>
> Regards,
> Stéphane


More information about the Dev mailing list