Re: [PATCH 1/2] lsns: add netnsid column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, my biggest question is "should I send an updated version of patch?" :-)

You wrote in https://marc.info/?l=util-linux-ng&m=151074416720085&w=2:
>  I'm ready to do all the changes (you don't have to resend the patch).

I think you may have improved version of code.
I would like to start from it for reflecting the new comments (if I should do).

Masatake YAMATO


> On Thu, Nov 16, 2017 at 03:24:39AM +0900, Masatake YAMATO wrote:
>> By parsing this file (with libmount), we can say
>> /run/netns/UTIL-LINUX-LSNS-TEST-NS is the logical name for
>> net:[4026532562] either the mount point is created by ip command or
>> not.
> 
> Nice. Yes, all you need is:
> 
>    tab = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
> 
> .. see for example sys-utils/fstrim.c, and mnt_fs_get_fstype() and
> mnt_fs_get_source().
> 
>> "ip link show" still uses netnsid, so I think my patch still makes
>> sense. However, as you wrote, making a column for logical name,
>> is more useful. It is not limited to net namespace.
>> 
>> A namespace can have more than one logical names.
>> I wonder how to print them in a column.
> 
> libsmart supports multi-line cells:
> 
>  * use SCOLS_FL_WRAP for the column
> 
>  * set wrap function, for example in lsns.c: init_scols_table():
> 
>       cl =  scols_table_new_column(tab, col->name, col->whint, flags)
>  
>       if (flags & SCOLS_FL_WRAP) {
>                 scols_column_set_wrapfunc(cl,
>                                 scols_wrapnl_chunksize,
>                                 scols_wrapnl_nextchunk,
>                                 NULL);
>                 scols_column_set_safechars(cl, "\n");
>       }
> 
> 
>  * and in add_scols_line() where you compose output add to the table
>    string where namespace names are separated by '\n', e.g. "aaa\nbbb"
> 
> 
> This feature should be probably disabled for --raw, maybe add --nowrap
> and in this case use "," as separator and remove SCOLS_FL_WRAP for the
> column in init_scols_table().
> 
>     Karel
> 
> -- 
>  Karel Zak  <kzak@xxxxxxxxxx>
>  http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux