Hi Serge,

> However, a comment about
> +/* Normalize and split path: Leading and trailing / are removed, multiple
> + * / are compactified, .. and . are resolved (.. on the top level is 
> considered
> + * identical to .).
> + * Examples:
> + *     /            ->   { NULL }
> + *     foo/../bar   ->   { bar, NULL }
> + *     ../../       ->   { NULL }
> + *     ./bar/baz/.. ->   { bar, NULL }
> + *     foo//bar     ->   { foo, bar, NULL }
> + */
> +extern char **lxc_normalize_path(const char *path);
> 
> That's fine for what you're doing with cgroup paths, but given the
> function name people might want to start using it for general pathnames.
> If they do, they'll need to separately check path[0] to determine
> whether the normalized path was absolute or not.
> 
> Maybe the comment you have here is clear enough to warn anyone against
> getting confused...  I'm just a bit worried it could bite us later.

I'd be more worried if the function just returned a simple string, i.e.
/foo/.../bar -> foo/bar or so. But since the function also splits it
into components (I've done that because it's more convenient for then
iteratively creating a bunch of directories), the return type itself
should be something that makes people look at the function in more
detail before using it - and they should see the comment. But if you
think the comment needs clarification or maybe you want to rename the
function to be lxc_normalize_and_split_path() or so, I don't have any
objections.

-- Christian

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to